I am sending POST request to UPS paperless document api for upload user created form but i am getting The XML document is not well formed My Request Message is.
<?xml version=\"1.0\"?>
<UPSSecurity>
<UsernameToken>
<Username>******</Username>
<Password>******</Password>
</UsernameToken>
<ServiceAccessToken>
<AccessLicenseNumber>*************</AccessLicenseNumber>
</ServiceAccessToken>
</UPSSecurity>
<?xml version=\"1.0\"?>
<UploadRequest>
<Request>
<TransactionReference>
<CustomerContext></CustomerContext>
</TransactionReference>
</Request>
<ShipperNumber>??????</ShipperNumber>
<UserCreatedForm>
<UserCreatedFormFileName>Sample Test File</UserCreatedFormFileName>
<UserCreatedFormFile>SGVsbG8gQW5rdXI=</UserCreatedFormFile>
<UserCreatedFormFileFormat>txt</UserCreatedFormFileFormat>
<UserCreatedFormDocumentType>011</UserCreatedFormDocumentType>
</UserCreatedForm>
</UploadRequest>
After posting this request with REST I am getting this response..
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<soapenv:Fault>
<faultcode>Client</faultcode>
<faultstring>An exception has been raised as a result of client data.</faultstring>
<detail>
<err:Errors xmlns:err="http://www.ups.com/schema/xpci/1.0/error">
<err:ErrorDetail>
<err:Severity>Hard</err:Severity>
<err:PrimaryErrorCode>
<err:Code>10001</err:Code>
<err:Description>The XML document is not well formed</err:Description>
<err:Digest>XML Declaration not well-formed
org.apache.xmlbeans.impl.piccolo.io.FileFormatException: XML Declaration not well-formed
at org.apache.xmlbeans.impl.piccolo.xml.XMLDeclParser.parse(XMLDeclParser.java:907)
at org.apache.xmlbeans.impl.piccolo.xml.XMLInputReader.parseXMLDeclaration(XMLInputReader.java:56)
at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader.processXMLDecl(XMLStreamReader.java:687)
at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader.reset(XMLStreamReader.java:119)
at org.apache.xmlbeans.impl.piccolo.xml.DocumentEntity.open(DocumentEntity.java:94)
at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.reset(PiccoloLexer.java:982)
at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:709)
at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3456)
at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
at org.apache.xmlbeans.XmlObject$Factory.parse(XmlObject.java:663)
at com.ups.uxf.process.ServiceRequest.setMessage(ServiceRequest.java:545)
at com.ups.uxf.servlet.UXFServlet._doPost(UXFServlet.java:185)
at com.ups.wsf.servlet.WSFServlet.doPost(WSFServlet.java:511)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:751)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:845)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:338)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:75)
at com.ups.webappcommon.filter.AkamaiFilter.doFilter(AkamaiFilter.java:33)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3262)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2171)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2075)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1514)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:255)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
</err:Digest>
</err:PrimaryErrorCode>
<err:Location/>
</err:ErrorDetail>
</err:Errors>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
I am using RESTClient. Please Help. Thanks in advance.
The first XML declaration is incorrect.
Remedy: Delete the \
characters.
The second XML declaration is incorrect because it also has \
characters and because there can be at most one XML declaration and, if it appears, it must be at the very top of an XML document.
Remedy: Delete the second XML declaration.
The request has two root elements.
Remedy: Delete one of them, or wrap them both in a single root element.