+ Start a Discussion
Andy BoettcherAndy Boettcher 

Parsing SOAP Response Message

Howdy.

 

I'm trying to make a call to an external web service - the WSDL imports correctly, I'm able to actually invoke the port call, and the processing works on the remote side, but I get a Callout Exception thrown on the response envelope:

 

System.CalloutException: Web service callout failed: Failed to get next element
What I've found is that APEX is successfully getting back the entire envelope (APEX Logs) but something must have either got whacked during the WSDL import on the response class, or the web service is returning data in a format that WebServiceCallout.invoke just can't deal with.
Code for response class:
    public class deliveryActivitySinceResponse {
        public WS_CO.deliveryActivity deliveryActivity;
        private String[] deliveryActivity_type_info = new String[]{'deliveryActivity','http://<clientwebsite>.com','deliveryActivity','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://<clientwebsite>.com','false','false'};
        private String[] field_order_type_info = new String[]{'deliveryActivity'};
    }

 

SOAP response envelope:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:deliveryActivitySinceResponse xmlns:ns2="http://<clientname>.com">
<deliveryActivity nextSequence="465x">
<delivery {multiple attributes}>
<delivery {multiple attributes}>
<delivery {multiple attributes}>
<delivery {multiple attributes}>
<delivery {multiple attributes}>
</deliveryActivity>
</soap:Body>
</soap:Envelope>

 

It's definitely getting back - but my guess is that the callout method can't parse that XML right.  I've done countless other integrations like this, and the only thing I can see that's fundamentally different from the previous ones is that element heirarchy one more level deep (ns2 to deliveryActivitySinceResponse to deliveryActivity) - the other ones I've done don't go that one more level deep.
Thoughts?  Thanks in advance!
-Andy
Yishay1Yishay1

Hi,

 

did you overcome this?

I have the same exception.

 

Thanks,

Yishay