SOAP request is not working for special character ~ - java

I have a soap request like this
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sec="http://secbrupdtreq.xsd">
<soapenv:Header/>
<soapenv:Body>
<sec:UpdateRequest>
<sec:SourceName>ACES</sec:SourceName>
<sec:AgmntXrefBusKey>001~0011256482196</sec:AgmntXrefBusKey>
<sec:IndividualAgreementId></sec:IndividualAgreementId>
<sec:CustomerRolePlayerId></sec:CustomerRolePlayerId>
<sec:AnnualIncomeAmt></sec:AnnualIncomeAmt>
<sec:RiskToleranceCode></sec:RiskToleranceCode>
<sec:RiskToleranceCodeTxt></sec:RiskToleranceCodeTxt>
<sec:Occupation></sec:Occupation>
<sec:NASDAffiliation></sec:NASDAffiliation>
<sec:NetWorthCode></sec:NetWorthCode>
<sec:NetWorthCodeTxt></sec:NetWorthCodeTxt>
<sec:DeclaredNetWorthAmt></sec:DeclaredNetWorthAmt>
<sec:LastSuitabilityReviewDt></sec:LastSuitabilityReviewDt>
<sec:SuitabilityInScopeFlag></sec:SuitabilityInScopeFlag>
<sec:SuitabilityOutofScopeReasonCode></sec:SuitabilityOutofScopeReasonCode>
<sec:SuitabilityOutofScopeReasonTxt></sec:SuitabilityOutofScopeReasonTxt>
<sec:CreationTs></sec:CreationTs>
<sec:SUSAgreementId></sec:SUSAgreementId>
<sec:CategoryId1>45</sec:CategoryId1>
<sec:CategoryId2></sec:CategoryId2>
<sec:CategoryId3></sec:CategoryId3>
</sec:UpdateRequest>
</soapenv:Body>
</soapenv:Envelope>
In soap ui I am getting
"org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified".
I am using Java 1.8.
How can I solve this problem?

Try to add the xml-header with encoding type of your request:
<?xml version="1.0" encoding="UTF-8"?>

Related

How can I extract all the error message from message tag

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>XXXException</faultstring>
<detail>
<XXXFault xmlns="http://services.webservices.xxxxxx.com/xsd">
<exceptionName>com.xxxxxx.common.exceptions.ValidationException</exceptionName>
<message>One or more Fields specified failed Validation:
Last Name: Validation Exception:
A value was not specified for Required Field = 'Last Name'
Salutation: Validation Exception:
A value was not specified for Required Field = 'Salutation'
First Name: Validation Exception:
A value was not specified for Required Field = 'First Name'
State: Validation Exception:
A value was not specified for Required Field = 'State'</message>
</XXXFault>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
This is SOAP response for a SOAP request and I want to get all the error message [A value was not specified for Required Field = 'Last Name' and A value was not specified for Required Field = 'Salutation' and A value was not specified for Required Field = 'First Name' and A value was not specified for Required Field = 'State'].

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?

Java: Get Sample Request XML from wsdl

Is there any way one could get the sample request xml using the wsdl(url) alone?
Here is a sample wsdl: http://www.webservicemart.com/uszip.asmx?WSDL
Sample Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ws="http://webservicemart.com/ws/">
<soapenv:Header/>
<soapenv:Body>
<ws:ValidateZip>
<!--Optional:-->
<ws:ZipCode>?</ws:ZipCode>
</ws:ValidateZip>
</soapenv:Body>
</soapenv:Envelope>
I know there are tools out there like SOAPUI and others which could do this. But is there any other way without using these tools once could achieve it using java?
Using wsimport would be one option that would get me the java source, this is more static. Is there a dynamic way to do this?
Exception encountered:
18:57:59,677 WARN [SoapUI] Missing folder [D:\TestAutomation\Z_ZZLastResort\.\ext] for external libraries
18:57:59,920 INFO [DefaultSoapUICore] initialized soapui-settings from [C:\Users\mike\soapui-settings.xml]
Progress: 1 - Caching Definition from url [http://www.webservicemart.com/uszip.asmx?WSDL]
18:58:00,587 INFO [SchemaUtils] Added default schema from file:/C:/Users/mike/Desktop/soapui-4.5.1-SNAPSHOT.jar!/com/eviware/soapui/resources/xsds/xop.xsd with targetNamespace http://www.w3.org/2004/08/xop/include
18:58:00,625 INFO [SchemaUtils] Added default schema from file:/C:/Users/mike/Desktop/soapui-4.5.1-SNAPSHOT.jar!/com/eviware/soapui/resources/xsds/XMLSchema.xsd with targetNamespace http://www.w3.org/2001/XMLSchema
18:58:00,627 INFO [SchemaUtils] Added default schema from file:/C:/Users/mike/Desktop/soapui-4.5.1-SNAPSHOT.jar!/com/eviware/soapui/resources/xsds/xml.xsd with targetNamespace http://www.w3.org/XML/1998/namespace
18:58:00,628 INFO [SchemaUtils] Added default schema from file:/C:/Users/mike/Desktop/soapui-4.5.1-SNAPSHOT.jar!/com/eviware/soapui/resources/xsds/swaref.xsd with targetNamespace http://ws-i.org/profiles/basic/1.1/xsd
18:58:00,629 INFO [SchemaUtils] Added default schema from file:/C:/Users/mike/Desktop/soapui-4.5.1-SNAPSHOT.jar!/com/eviware/soapui/resources/xsds/xmime200505.xsd with targetNamespace http://www.w3.org/2005/05/xmlmime
18:58:00,637 INFO [SchemaUtils] Added default schema from file:/C:/Users/mike/Desktop/soapui-4.5.1-SNAPSHOT.jar!/com/eviware/soapui/resources/xsds/xmime200411.xsd with targetNamespace http://www.w3.org/2004/11/xmlmime
18:58:00,638 INFO [SchemaUtils] Added default schema from file:/C:/Users/mike/Desktop/soapui-4.5.1-SNAPSHOT.jar!/com/eviware/soapui/resources/xsds/soapEnvelope.xsd with targetNamespace http://schemas.xmlsoap.org/soap/envelope/
18:58:00,641 INFO [SchemaUtils] Added default schema from file:/C:/Users/mike/Desktop/soapui-4.5.1-SNAPSHOT.jar!/com/eviware/soapui/resources/xsds/soapEncoding.xsd with targetNamespace http://schemas.xmlsoap.org/soap/encoding/
18:58:00,643 INFO [SchemaUtils] Added default schema from file:/C:/Users/mike/Desktop/soapui-4.5.1-SNAPSHOT.jar!/com/eviware/soapui/resources/xsds/soapEnvelope12.xsd with targetNamespace http://www.w3.org/2003/05/soap-envelope
18:58:00,645 INFO [SchemaUtils] Added default schema from file:/C:/Users/mike/Desktop/soapui-4.5.1-SNAPSHOT.jar!/com/eviware/soapui/resources/xsds/soapEncoding12.xsd with targetNamespace http://www.w3.org/2003/05/soap-encoding
Progress: 2 - Loading [http://www.webservicemart.com/uszip.asmx?WSDL]
18:58:00,648 DEBUG [WsdlLoader] Getting wsdl component from [http://www.webservicemart.com/uszip.asmx?WSDL]
18:58:01,073 DEBUG [HttpClientSupport$SoapUIHttpClient] Attempt 1 to execute request
18:58:01,074 DEBUG [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] Sending request: GET /uszip.asmx?WSDL HTTP/1.1
18:58:01,314 DEBUG [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] Connection closed
18:58:01,314 DEBUG [HttpClientSupport$SoapUIHttpClient] Closing the connection.
18:58:01,314 DEBUG [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] Connection closed
18:58:01,314 INFO [HttpClientSupport$SoapUIHttpClient] I/O exception (java.net.SocketException) caught when processing request: Connection reset
18:58:01,316 DEBUG [HttpClientSupport$SoapUIHttpClient] Connection reset
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:149)
at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:110)
at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:264)
at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:98)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:252)
at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:281)
at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:247)
at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:219)
at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$SoapUIHttpRequestExecutor.doReceiveResponse(HttpClientSupport.java:133)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:633)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:454)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
at com.eviware.soapui.impl.wsdl.support.wsdl.UrlWsdlLoader$LoaderWorker.construct(UrlWsdlLoader.java:226)
at com.eviware.soapui.impl.wsdl.support.wsdl.UrlWsdlLoader.load(UrlWsdlLoader.java:138)
at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader.loadXmlObject(WsdlLoader.java:121)
at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:535)
at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:524)
at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionCache.update(AbstractDefinitionCache.java:97)
at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext$Loader.construct(AbstractDefinitionContext.java:226)
at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:46)
at com.eviware.soapui.support.swing.SwingWorker$2.run(SwingWorker.java:149)
at java.lang.Thread.run(Unknown Source)
18:58:01,319 INFO [HttpClientSupport$SoapUIHttpClient] Retrying request
18:58:01,319 DEBUG [HttpClientSupport$SoapUIHttpClient] Reopening the direct connection.
18:58:01,602 DEBUG [HttpClientSupport$SoapUIHttpClient] Attempt 2 to execute request
18:58:01,602 DEBUG [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] Sending request: GET /uszip.asmx?WSDL HTTP/1.1
18:58:02,200 DEBUG [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] Receiving response: HTTP/1.1 200 OK
18:58:02,210 DEBUG [HttpClientSupport$SoapUIHttpClient] Connection can be kept alive indefinitely
Progress: 1 - Loading Definition from url
18:58:02,260 DEBUG [AbstractDefinitionContext] Loading Definition...
18:58:02,277 DEBUG [WsdlInterfaceDefinition] Loading WSDL: http://www.webservicemart.com/uszip.asmx?WSDL
18:58:02,277 DEBUG [AbstractWsdlDefinitionLoader] Returning baseInputSource [http://www.webservicemart.com/uszip.asmx?WSDL]
Retrieving document at 'http://www.webservicemart.com/uszip.asmx?WSDL'.
18:58:02,347 INFO [SchemaUtils] Loading schema types from [http://www.webservicemart.com/uszip.asmx?WSDL]
18:58:02,347 INFO [SchemaUtils] Getting schema http://www.webservicemart.com/uszip.asmx?WSDL
18:58:02,357 ERROR [SoapUI] An error occured [org.apache.xmlbeans.impl.xb.xsdschema.impl.SchemaDocumentImpl], see error log for details
java.lang.ArrayStoreException: org.apache.xmlbeans.impl.xb.xsdschema.impl.SchemaDocumentImpl
at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getSchemas(SchemaUtils.java:418)
at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getSchemas(SchemaUtils.java:327)
at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.loadSchemaTypes(SchemaUtils.java:192)
at com.eviware.soapui.impl.support.definition.support.XmlSchemaBasedInterfaceDefinition.loadSchemaTypes(XmlSchemaBasedInterfaceDefinition.java:79)
at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlInterfaceDefinition.load(WsdlInterfaceDefinition.java:61)
at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlContext.loadDefinition(WsdlContext.java:66)
at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlContext.loadDefinition(WsdlContext.java:30)
at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext.cacheDefinition(AbstractDefinitionContext.java:268)
at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext.access$400(AbstractDefinitionContext.java:44)
at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext$Loader.construct(AbstractDefinitionContext.java:235)
at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:46)
at com.eviware.soapui.support.swing.SwingWorker$2.run(SwingWorker.java:149)
at java.lang.Thread.run(Unknown Source)
18:58:02,359 ERROR [SoapUI] An error occured [com.eviware.soapui.impl.wsdl.support.xsd.SchemaException], see error log for details
com.eviware.soapui.impl.wsdl.support.xsd.SchemaException
at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getSchemas(SchemaUtils.java:512)
at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getSchemas(SchemaUtils.java:327)
at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.loadSchemaTypes(SchemaUtils.java:192)
at com.eviware.soapui.impl.support.definition.support.XmlSchemaBasedInterfaceDefinition.loadSchemaTypes(XmlSchemaBasedInterfaceDefinition.java:79)
at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlInterfaceDefinition.load(WsdlInterfaceDefinition.java:61)
at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlContext.loadDefinition(WsdlContext.java:66)
at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlContext.loadDefinition(WsdlContext.java:30)
at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext.cacheDefinition(AbstractDefinitionContext.java:268)
at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext.access$400(AbstractDefinitionContext.java:44)
at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext$Loader.construct(AbstractDefinitionContext.java:235)
at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:46)
at com.eviware.soapui.support.swing.SwingWorker$2.run(SwingWorker.java:149)
at java.lang.Thread.run(Unknown Source)
18:58:02,360 ERROR [SoapUI] An error occured [com.eviware.soapui.impl.wsdl.support.xsd.SchemaException], see error log for details
com.eviware.soapui.impl.wsdl.support.xsd.SchemaException
at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getSchemas(SchemaUtils.java:512)
at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getSchemas(SchemaUtils.java:327)
at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.loadSchemaTypes(SchemaUtils.java:192)
at com.eviware.soapui.impl.support.definition.support.XmlSchemaBasedInterfaceDefinition.loadSchemaTypes(XmlSchemaBasedInterfaceDefinition.java:79)
at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlInterfaceDefinition.load(WsdlInterfaceDefinition.java:61)
at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlContext.loadDefinition(WsdlContext.java:66)
at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlContext.loadDefinition(WsdlContext.java:30)
at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext.cacheDefinition(AbstractDefinitionContext.java:268)
at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext.access$400(AbstractDefinitionContext.java:44)
at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext$Loader.construct(AbstractDefinitionContext.java:235)
at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:46)
at com.eviware.soapui.support.swing.SwingWorker$2.run(SwingWorker.java:149)
at java.lang.Thread.run(Unknown Source)
18:58:02,363 ERROR [AbstractDefinitionContext] Error loading schema types from http://www.webservicemart.com/uszip.asmx?WSDL, see log for details
18:58:35,061 DEBUG [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] Connection closed
SOAPUI also provide java API to create request/response
public class SOAPInputGenerator {
public static void main(String[] args) throws Exception {
WsdlProject project = new WsdlProject();
WsdlInterface[] wsdls = WsdlImporter.importWsdl(project, "http://localhost:7000/Solicitud?wsdl");
WsdlInterface wsdl = wsdls[0];
for (Operation operation : wsdl.getOperationList()) {
WsdlOperation wsdlOperation = (WsdlOperation) operation;
System.out.println("OP:"+wsdlOperation.getName());
System.out.println("Request:");
System.out.println(wsdlOperation.createRequest(true));
System.out.println("Response:");
System.out.println(wsdlOperation.createResponse(true));
}
}
}
JAR location for SOAP UI libraries
http://www.soapui.org/repository/eviware/jars/
If you don't want use SOAPUI directly , you may find reficio which would be very useful.
Subset of SoapUI library API with example can be find here
https://github.com/reficio/soap-ws
http://www.reficio.org/projects/
This is an open-source project to support SOAP in a purely XML way in Java
You can create the client side stubs using wsimport tool and use jaxb to convert your request object to SOAP xml.

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+tk3Pdm5YcSM0ZKfQJyUChIL1mjxALhwdC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KwxIuXMWGUUm3xzNXv4VJ2fwk7Tpy+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.
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.

Error occurred while buffering incoming SOAP message using Metro client

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.

Categories

Resources