zhangjixing / sfdc-wsc

Automatically exported from code.google.com/p/sfdc-wsc
0 stars 0 forks source link

Error while reading multi-part Response #36

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I try to connect to call a webservice that send a multi-part response.

1. Creating a com.sforce.ws.ConnectorConfig (call config)
2. Setting the ServiceEndpoint
3. Deactive Compression
4. Creating SoapConnection using Connector.newConnection(config);
5. Call a function
6. Having an exception

Caused by: com.sforce.ws.ConnectionException: Failed to get next element
    at com.sforce.ws.parser.XmlInputStream.nextTag(XmlInputStream.java:168)
    at com.sforce.ws.transport.SoapConnection.readSoapEnvelopeStart(SoapConnection.java:246)
    at com.sforce.ws.transport.SoapConnection.bind(SoapConnection.java:160)
    at com.sforce.ws.transport.SoapConnection.receive(SoapConnection.java:144)
    at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:98)
    at xxx.xxxxxx.SoapConnection.myFunction(SoapConnection.java:XX)
    ... X more
Caused by: com.sforce.ws.parser.XmlPullParserException: only whitespace content 
allowed before start tag and not - (position: START_DOCUMENT seen \r\n-... 
@2:2) 
    at com.sforce.ws.parser.MXParser.parseProlog(MXParser.java:1505)
    at com.sforce.ws.parser.MXParser.nextImpl(MXParser.java:1382)
    at com.sforce.ws.parser.MXParser.next(MXParser.java:1085)
    at com.sforce.ws.parser.MXParser.nextTag(MXParser.java:1070)
    at com.sforce.ws.parser.XmlInputStream.nextTag(XmlInputStream.java:166)
    ... 13 more

Response is good but because of the multi-part data parse failed. It try to 
parse as XML the whole http request body, and not just the XML part.

Here is an example of the http request body:
--uuid:09210c62-1047-4f46-a159-1fd1a867b297
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml";
Content-Transfer-Encoding: binary
Content-ID: <root.message@cxf.apache.org>

[Here goes the XML we want to parse]
--uuid:09210c62-1047-4f46-a159-1fd1a867b297--

I use SFDC-WSC-20 on Linux Fedora Core 11 with Jboss 5.1 and JDK 1.6

I call another webservice on the same server that do not use Multi-part 
response and it works.

Can SFDC-WSC works with multi-part Response?
If yes, how?
Otherwise can you help for fixing it?

Original issue reported on code.google.com by jmpac...@gmail.com on 24 Feb 2011 at 3:05

GoogleCodeExporter commented 8 years ago
Is this a soap with attachment call? Multi part response is not supported, 
sorry.

Original comment by manoj.ch...@gmail.com on 24 Feb 2011 at 3:36

GoogleCodeExporter commented 8 years ago

Original comment by manoj.ch...@gmail.com on 6 Jul 2011 at 12:30