Error occurred while buffering incoming SOAP message using Metro client - java

I am using Metro 2 client to consume the "Secure wcf web service in Java". But Metro client does not gives any response and stay in hang mode after very long time it produce the output as an error:
Stack Trace:
SEVERE: WSSMSG0001: Error occurred while buffering incoming SOAP message.
com.ctc.wstx.exc.WstxParsingException: Illegal character entity: expansion character (code 0x1a
at [row,col {unknown-source}]: [1,6396222]
at com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:606)
at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:479)
at com.ctc.wstx.sr.StreamScanner.reportIllegalChar(StreamScanner.java:2442)
at com.ctc.wstx.sr.StreamScanner.validateChar(StreamScanner.java:2389)
at com.ctc.wstx.sr.StreamScanner.resolveCharEnt(StreamScanner.java:2355)
at com.ctc.wstx.sr.StreamScanner.fullyResolveEntity(StreamScanner.java:1501)
at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2726)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1065)
at com.sun.xml.ws.util.xml.XMLStreamReaderToXMLStreamWriter.bridge(XMLStreamReaderToXMLStreamWriter.java:142)
at com.sun.xml.ws.message.stream.StreamMessage.writePayloadTo(StreamMessage.java:376)
at com.sun.xml.ws.message.stream.StreamMessage.writeEnvelope(StreamMessage.java:412)
at com.sun.xml.ws.message.stream.StreamMessage.writeTo(StreamMessage.java:390)
at com.sun.xml.ws.security.message.stream.LazyStreamBasedMessage.readMessage(LazyStreamBasedMessage.java:476)
at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.verifyInboundMessage(SecurityTubeBase.java:444)
at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processClientResponsePacket(SecurityClientTube.java:434)
at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processResponse(SecurityClientTube.java:362)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:972)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:910)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:873)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:775)
at com.sun.xml.ws.client.Stub.process(Stub.java:429)
at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:168)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:102)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:151)
at $Proxy44.pullCustomers(Unknown Source)
at com.tekriti.client.Client.test(Client.java:106)
at com.tekriti.client.Client.main(Client.java:44)
com.sun.xml.ws.encoding.soap.DeserializationException: Failed to read a response: javax.xml.bind.UnmarshalException
- with linked exception:
[javax.xml.stream.XMLStreamException: Internal XSB error: Invalid State=0]
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:141)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:102)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:151)
at $Proxy44.pullCustomers(Unknown Source)
at com.tekriti.client.Client.test(Client.java:106)
at com.tekriti.client.Client.main(Client.java:44)
Caused by: javax.xml.bind.UnmarshalException
I am trying to fix this issue but no luck, Metro client is unable to parse the SOAP response in a correct way. I don't know where I am doing mistake or I have to use something else.
I am using Netbeans 7.1 and Metro 2.2.
Please give your suggestions or if you had such problem in your past please do share with me.
updated:
This is working fine:
Dispatch<Source> sourceDispatch = null;
sourceDispatch = service.createDispatch(portQName, Source.class, Service.Mode.MESSAGE);
((BindingProvider)sourceDispatch).getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, "http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullCustomers");
((BindingProvider)sourceDispatch).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
Source result = sourceDispatch.invoke(new StreamSource(new StringReader(req)));
req contains the below one:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action>http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullCustomers</Action>
</s:Header>
<s:Body>
<PullCustomers xmlns="http://cdx.dealerbuilt.com/Api/0.97/">
<searchCriteria xmlns:d4p1="http://schemas.datacontract.org/2004/07/DealerBuilt.BaseApi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<d4p1:ActivityStoreIds xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d5p1:long>64</d5p1:long>
</d4p1:ActivityStoreIds>
<d4p1:EnvironmentIds xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d5p1:long>27</d5p1:long>
</d4p1:EnvironmentIds>
</searchCriteria>
</PullCustomers>
</s:Body>
</s:Envelope>
But it produces Source in output and takes SOAP envelope in request.
I Need this should be work.
org.tempuri.StandardApi service = new org.tempuri.StandardApi();
CustomerSearchCriteriaType criteriaType = new CustomerSearchCriteriaType();
QName environmentQName = new QName("http://schemas.datacontract.org/2004/07/DealerBuilt.BaseApi", "EnvironmentIds");
ArrayOflong arrayOflong = new ArrayOflong();
arrayOflong.getLong().add(27l);
JAXBElement<ArrayOflong> environmentIds = new JAXBElement<ArrayOflong>(environmentQName, ArrayOflong.class, arrayOflong);
criteriaType.setEnvironmentIds(environmentIds);
QName activityQName = new QName("http://schemas.datacontract.org/2004/07/DealerBuilt.BaseApi", "ActivityStoreIds");
ArrayOflong arrayOfActivity = new ArrayOflong();
arrayOfActivity.getLong().add(64l);
JAXBElement<ArrayOflong> activityIds = new JAXBElement<ArrayOflong>(activityQName, ArrayOflong.class, arrayOfActivity);
criteriaType.setActivityStoreIds(activityIds);
ArrayOfCustomerType customers = service.getCustomBindingIStandardApi().pullCustomers(criteriaType);
if (customers != null) {
System.out.println("Size of Customers::::" + customers.getCustomer().size());
}
Request contains
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<PullCustomers xmlns="http://cdx.dealerbuilt.com/Api/0.97/">
<searchCriteria>
<ActivityStoreIds xmlns="http://schemas.datacontract.org/2004/07/DealerBuilt.BaseApi">
<long xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">64</long>
</ActivityStoreIds>
<EnvironmentIds xmlns="http://schemas.datacontract.org/2004/07/DealerBuilt.BaseApi">
<long xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">27</long>
</EnvironmentIds>
</searchCriteria>
</PullCustomers>
</soapenv:Body>
</soapenv:Envelope>
But it hangs while producing output and after very long time it produce the error mentioned above.
Is the difference between the requests causes the problem or something else?

I think the data web-service is returning to client contain illegal character 0x1a which is EOF.
XML doesn't allow CONTROL CHAR in it. As you are using SOAP ultimately XML.
See the similar issue: illegal character in xml document
solution:
1. Either you can eliminate CONTROL char
2. Or Encode it in web-service and decode it at SOAP client.

Related

Apache HTTP Java Client causing Premature end of Content-Length delimited message body

I am trying to solve a very puzzling error. I have the following code executing an HTTP Post to a remove server.
httpPost.setEntity(new StringEntity(requestAsString));
HttpResponse httpResponse = httpClient.execute(httpHost, httpPost);
Arrays.asList(httpResponse.getAllHeaders()).stream().forEach(header -> System.out.println(header.getName() + " : " + header.getValue()));
Thread.sleep(10_000);
List<DataRecord> value = Arrays.asList(objectMapper.readValue(httpResponse.getEntity().getContent(), DataRecord[].class));
The response is ~63Mb and this only happens with large responses. When I run this code I get the following error:
com.fasterxml.jackson.databind.JsonMappingException: Premature end of Content-Length delimited message body (expected: 63476765; received: 404420 (through reference chain: java.lang.Object[][1189])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:391)
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:363)
at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:206)
at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:21)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4001)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3058)
at com.company.Class1.queryData(Class1.java:74)
... 5 more
Caused by: org.apache.http.ConnectionClosedException: Premature end of Content-Length delimited message body (expected: 63476765; received: 404420
at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:178)
at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:135)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._loadMore(UTF8StreamJsonParser.java:205)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._parseFloat(UTF8StreamJsonParser.java:1524)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._parsePosNumber(UTF8StreamJsonParser.java:1363)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextFieldName(UTF8StreamJsonParser.java:1025)
at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBind(MapDeserializer.java:448)
at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:367)
at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:29)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:136)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:195)
However, this error does not happen if I remove
Thread.sleep(10_000);
If the issue was that the client was not getting the full response from the server, I would expect to see the problem exist even if I did not have the Thread sleep in there. The issue also will go away if I shorten the Thread.sleep(...) to only 5 seconds. It seems as though it's a time problem, but since I already have the HttpResponse object before I call Thread.sleep(...), I can't find anything that could be timing out. Any help with this issue is appreciated.

Unmarshalling Error: unexpected element (uri:"", local:“objectname”)

I'm using jaxb2-marshaller to generate classes to communicate with a webservice. Java-classes are generated with use of wsdl files.
I consume some operations without problems, but with one in a specific scenario where the response don't has the namespace on the tag.
For one operation i got the response like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://www.xxx.xxx/xxxxx" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<outputType>
<test>1</test>
</outputType>
</soapenv:Body>
</soapenv:Envelope>
And i call it with WebServiceTemplate from springframework
public int test(String command) throws Exception {
InputType input = new InputType();
input.setCommandName(command);
ObjectFactory objFactory = new ObjectFactory();
JAXBElement<InputType> jaxbData = objFactory.createSendRemoteComand(input);
JAXBElement<OutputType> response = (JAXBElement<OutputType>) getWebServiceTemplate()
.marshalSendAndReceive(jaxbData);
return response.getValue().getTest();
}
And i receive the stack error below because the XML "outputType" don't have the namespace like "tns:outputType", i discovery it mocking response in SOAP UI.
javax.xml.bind.UnmarshalException: elemento inesperado (uri:"", local:"outputType").
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:726) ~[na:1.8.0_131]
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:247) ~[na:1.8.0_131]
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:242) ~[na:1.8.0_131]
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:109) ~[na:1.8.0_131]
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1131) ~[na:1.8.0_131]
Would anyone know a way to deal with the problem?

Getting URISyntaxException in while calling SOAP web service

I'm consuming a SOAP web service. When the service is called, I get this exception:
java.io.IOException: java.net.URISyntaxException: Illegal character in path at index 66:
I tried:
encodedUrl = URLEncoder.encode(encodedUrl, "UTF-8");
and I got this error:
java.lang.IllegalArgumentException: URI is not absolute
at java.net.URI.toURL(URI.java:1088) [rt.jar:1.8.0_91]
at org.apache.cxf.transport.http.URLConnectionHTTPConduit.createConnection(URLConnectionHTTPConduit.java:92)
at org.apache.cxf.transport.http.URLConnectionHTTPConduit.setupConnection(URLConnectionHTTPConduit.java:103)
at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:478)
at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:572)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:481)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:136)
Make sure your URL value is complete, meaning it should contain a protocal, a host, a port(host and port are optional based on the protocal but for http and https they are mandatory), and the rest of the url

WstxUnexpectedCharException: Unexpected character '"' (code 34) in DOCTYPE declaration; expected a space between public and system identifiers

I am trying to solve the below issue for last couple of days but still not able to resolve it. I have searched lots of forums but all in vain.
*Little bit of history: My code was working well in the devp env but for accessing the production sever I received new URL and three new certificates after successfully including the certificates in new trust store file.I am facing below issue. Please help.
2013-11-25 11:32:30,373 INFO[BuilderUtil] OMException in getSOAPBuilder
org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '"' (code 34) in DOCTYPE declaration; expected a space between public and system identifiers
at [row,col {unknown-source}]:[1,46]
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:198)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:154)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:140)
at org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:686)
at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:197)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:108)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient$NonBlockingInvocationWorker.run(OutInAxisOperation.java:446)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '"' (code 34) in DOCTYPE declaration; expected a space between public and system identifiers
at [row,col {unknown-source}]: [1,46]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
at com.ctc.wstx.sr.BasicStreamReader.startDTD(BasicStreamReader.java:2482)
at com.ctc.wstx.sr.BasicStreamReader.nextFromPrologBang(BasicStreamReader.java:2398)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2058)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:668)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
... 14 more
2013-11-25 11:32:30,378 INFO [BuilderUtil] Remaining input stream :[]
2013-11-25 11:32:30,380 DEBUG [AuditUtilities] Request Message Id: urn:uuid:5f75a15c-ad57-4d00-b277-75fe7b1e241d
2013-11-25 11:32:30,380 DEBUG [AuditUtilities] Response Message Id: null
2013-11-25 11:32:30,380 DEBUG [AuditUtilities] Response Message Data: null
My SOAP request seems me correct:
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><ns4:product xmlns:ns4="http://ns.electronichealth.net.au/hi/xsd/common/CommonCoreElements/3.0" soapenv:mustUnderstand="false"><ns4:vendor><ns1:qualifier xmlns:ns1="http://ns.electronichealth.net.au/hi/xsd/common/QualifiedIdentifier/3.0">http://ns.electronichealth.net.au/id/hi/vendorid/1.0</ns1:qualifier><ns1:id xmlns:ns1="http://ns.electronichealth.net.au/hi/xsd/common/QualifiedIdentifier/3.0">SDS</ns1:id></ns4:vendor><ns4:productName>HI</ns4:productName><ns4:productVersion>10.1</ns4:productVersion><ns4:platform>LINUX</ns4:platform></ns4:product><h:signature xmlns:h="http://ns.electronichealth.net.au/hi/xsd/common/CommonCoreElements/3.0"><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /><ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><ds:Reference URI="#body-c3c18409-d0df-4aed-b294-87af248c61f0"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><ds:DigestValue>3pGWeWvyYHDdsDTu0F7qATI3Jp4=</ds:DigestValue></ds:Reference><ds:Reference URI="#timestamp-232e1ed9-f97a-4515-89bd-a3683fab0fce"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><ds:DigestValue>dGJxcKsX+y4jb0ndH1RQDqeWnTw=</ds:DigestValue></ds:Reference><ds:Reference URI="#user-69d4eead-8b69-4e0a-85d7-b2a58867aaa0"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><ds:DigestValue>9ET9aqC4jkINuYY8OhKsAJPEwX8=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>W24rpxUgpbTzxvJUoj5WpBsEssdaaddd56464t4eyYCAa2q9J0izrWIuukvOovde5h+xxxd1+5h/7JREGERGERGEGEGEGRTH5YT34R3EHYJGBDSEFERHJNFGGFFWEBzj7Jj3wfGs3WOLwsvhCuVBRY79mXTAxyQZYiUl7+tk3Pdm5YcSM0ZKfQJyUChIL1mjxALhwdCJkHOneJenjTgFaGRP+0iPF51TDc7l5ruxw8NdsSuN7P8D6lax3Fa4lck2iW/+t43yJ6cqTjZztMPuyKcYUgFhCS4334534234ERFGWBqyZhgRGFREGREG4543645FGER34WEFW4TERSygB8Gj+nx+217qRFTXD8/vcr8/BA1zWDLR05QdyZSDfuOfWTXpgfDcPTqedteeaww5cetv8L5J0dpFvRUkVDFGFGERcTOzmQALQZ+2C81RaNidKeQz++Q==</ds:SignatureValue><ds:KeyInfo><ds:X509Data><ds:X509Certificate>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</ds:X509Certificate></ds:X509Data></ds:KeyInfo></ds:Signature></h:signature><ns4:timestamp xmlns:ns4="http://ns.electronichealth.net.au/hi/xsd/common/CommonCoreElements/3.0" xml:id="timestamp-232e1ed9-f97a-4515-89bd-a3683fab0fce"><ns4:created>2013-11-25T11:32:27.296+11:00</ns4:created><ns4:expires>2013-11-25T12:32:27.296+11:00</ns4:expires></ns4:timestamp><ns4:user xmlns:ns4="http://ns.electronichealth.net.au/hi/xsd/common/CommonCoreElements/3.0" xml:id="user-69d4eead-8b69-4e0a-85d7-b2a58867aaa0"><ns1:qualifier xmlns:ns1="http://ns.electronichealth.net.au/hi/xsd/common/QualifiedIdentifier/3.0">http://sdspathology.com.au/id/hi/userid/1.0</ns1:qualifier><ns1:id xmlns:ns1="http://ns.electronichealth.net.au/hi/xsd/common/QualifiedIdentifier/3.0">TEST_SDS_USER_ID</ns1:id></ns4:user><wsa:To>https://www3.medicareaustralia.gov.au/pcert/soap/services/</wsa:To><wsa:MessageID>urn:uuid:5f75a15c-ad57-4d00-b277-75fe7b1e241d</wsa:MessageID><wsa:Action>http://ns.electronichealth.net.au/hi/svc/ConsumerSearchIHIBatchAsync/3.0/ConsumerSearchIHIBatchAsyncPortType/submitSearchIHIBatchRequest</wsa:Action></soapenv:Header><soapenv:Body xml:id="body-c3c18409-d0df-4aed-b294-87af248c61f0"><ns12:submitSearchIHIBatch xmlns:ns12="http://ns.electronichealth.net.au/hi/svc/ConsumerSearchIHIBatchAsync/3.0"><ns12:searchIHIBatchRequest><searchIHI xmlns="http://ns.electronichealth.net.au/hi/xsd/consumermessages/SearchIHI/3.0"><s36:medicareCardNumber xmlns:s36="http://ns.electronichealth.net.au/hi/xsd/consumercore/ConsumerCoreElements/3.0">2950249651</s36:medicareCardNumber></searchIHI><ns11:requestIdentifier xmlns:ns11="http://ns.electronichealth.net.au/hi/xsd/consumermessages/SearchIHIBatch/3.0">d1f21610-6cb9-4e60-9673-18f43a4500b5</ns11:requestIdentifier></ns12:searchIHIBatchRequest></ns12:submitSearchIHIBatch></soapenv:Body></soapenv:Envelope>
Please suggest.
Had a very similar issue. The WSDL file is delivered, but calls on the bind address fail with this bogus doctype error. In our prod environment, http requests coming from outside the corporate network are swapped across to https. The solution was to request the WSDL file using https, then everything worked.
The problem is that the response is not XML, it is most likely a HTML page. In my case, the SOAP service I was requesting did not exist so I was getting a HTML error page, which starts like
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
There error is referring to that second-last character, the double quote.
I had a similar problem.
You should have a syntax error at line 46 in your wsdl file
[row,col {unknown-source}]:[1,46]
I had the same problem.
I always receive this error when the response of my request is an unexpected HTML. I usually receive this response when I call to a request (URI) that the server doesn`t know and go back a 404 error code.
I had the same error message, but that is also for XML attributes as..:
<add>
<doc>
<field name=id>48</field> <!-- Incorrect -->
<field name="id">48</field><!-- Correct -->
.....
</doc>
</add>
I had an ampersand symbol (&) in a table, and then I used Jira's Page Properties Report macro to show that content from that cell, and it was failing with a similar error.

How do I handle HTTP error codes in an Axis 1 client

We're running an Axis 1 Java client. The web service will sometime return an HTTP error code 500 along with some meaningless HTML body content. In such cases, we get a
javax.xml.soap.SOAPException: org.xml.sax.SAXParseException: Content is not allowed in prolog. at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:796)
I'm certain there's an easy way to catch HTTP errors such that no class attempts to read the SOAP envelope, but I haven't been able to find the right terms to google.
How do I configure Axis (client-config.wsdd) or which handlers do I need to implement so that a webservice reply with an HTTP error code >= 400 can be properly handled?
Thanks
Simon
The cause is in Axis itself.
org.apache.axis.transport.http.HTTPSender#readFromSocket()
will log (level debug)
log.debug(outMsg.getSOAPEnvelope().toString());
If there is no valid SOAP envelope, that call causes the stacktrace above.
Simon

Categories

Resources