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

Rohit picture Rohit · Nov 25, 2013 · Viewed 70.2k times · Source

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+tk3Pdm5YcSM0ZKfQJyUChIL1mjxALhwdCJkHOneJenjTgF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m3xzNXv4VJ2fwk7Tpy+zmJbaxwu9ehyAcQpvJoirjicZ1qiapPFq4Y9qHecNOHt8Qe1fMrfmHJ2LxPvvTfNpX+VMYQsDGnhZ9yZgCXmi7+YfIk33605ddJGfzFh8Yp7PVAQtxbbHhSr+IqJTdpK8Tp/nPUJlzWZ1JKvWXRSzOH7OiuQVVda3tFUzPCCZ0El/ByIwwMmfDPy4=</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.

Answer

fred bear picture fred bear · Mar 20, 2014

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.