Forum Discussion

D1337's avatar
D1337
New Contributor
9 years ago

What is the difference between a request in curl and in SoapUI?

Hi.

 

I currently try to connect to a production endpoint throguh SoapUI, but when I try the server generates the following exception:

 

SAXParseException: The markup in the document preceding the root element must be well-formed.

 

This have had me stumped for some time (I am sure the XML is correct, other users have no problem with the same WSDL).

But then I tried the same request through curl, and the whole process went smoothly without problems.

I have used curl to setup the same header settings in both requests, but still curl is the only way working. As I need to set up a test project, SoapUI is the preferred way to run these requests. What is the difference between SoapUI and curl (when doing requests)?

 

Here is the request:

 

 

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:vmo="...">
  <soapenv:Header>
    <wsse: Security soapenv:mustUnderstand="1"
     xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsse:UsernameToken wsu:Id="UsernameToken-31860110"
       xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsse:Username>...</wsse:Username>
        <wsse: Password
         Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">...</wsse: Password>
      </wsse:UsernameToken>
    </wsse: Security>
  </soapenv:Header>
  <soapenv:Body>
    <vmo:CheckStatusRequest>
      <vmo:Voucher>
        <vmo:ActivationCode>323456789012</vmo:ActivationCode>
      </vmo:Voucher>
    </vmo:CheckStatusRequest>
  </soapenv:Body>
</soapenv:Envelope>

 

I have removed some sensitive information, but the requests is as above. And the four spaces you might notice is just there to not have smileys in my question :)

 

As I said, I have used curl to ensure that the http headers are the same, as they are presented as raw data in SoapUI. Any hint would be welcome. Also, the endpoint is behind https, if that makes any difference.

 

Best regards.

2 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    1. Is wsdl opens correctly in browser?
    2. What happens when you validate the request in soapUI's request editor using right click and validate?
    3. It is mentioned some headers are needed, have you added those headers in soapUI request?
    4. How does raw request looks using curl vs soapui?
    5. Please post full stacktrace.
    • D1337's avatar
      D1337
      New Contributor

      Hi, thanks for the response.

       

      1. The wsdl is not available publicly. It is given to us from the company.
      2. It validates OK.
      3. There is no (known) headers needed. Rather that if I add the headers missing in the curl request in comparrison to te SoapUI, I still get correct behaviour from curl.
      4. SoapUI:
        POST https://.../vmoproxy/services HTTP/1.1
        Accept-Encoding: gzip,deflate
        Content-Type: text/xml;charset=UTF-8
        SOAPAction: ""
        Content-Length: 965
        Host: 21...4:2443
        Connection: Keep-Alive
        User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
        
        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:vmo="...">
           <soapenv:Header>
              <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                 <wsse:UsernameToken wsu:Id="UsernameToken-31860110" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                    <wsse:Username>...</wsse:Username>
                    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">...</wsse:Password>
                 </wsse:UsernameToken>
              </wsse:Security>
           </soapenv:Header>
           <soapenv:Body>
              <vmo:CheckStatusRequest>
                 <vmo:Voucher>
                    <vmo:ActivationCode>323456789012</vmo:ActivationCode>
                 </vmo:Voucher>
              </vmo:CheckStatusRequest>
           </soapenv:Body>
        </soapenv:Envelope>

        curl
        POST https://.../vmoproxy/services HTTP/1.1
        User-Agent: curl/7.35.0
        Host: 21...4:2443
        Accept: */*
        Content-Type: text/xml;charset=UTF-8
        Content-Length: 882
        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
         xmlns:vmo="...">
          <soapenv:Header>
            <wsse:Security soapenv:mustUnderstand="1"
             xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
              <wsse:UsernameToken wsu:Id="UsernameToken-31860110"
               xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                <wsse:Username>...</wsse:Username>
                <wsse:Password
                 Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">...</wsse:Password>
              </wsse:UsernameToken>
            </wsse:Security>
          </soapenv:Header>
          <soapenv:Body>
            <vmo:CheckStatusRequest>
              <vmo:Voucher>
                <vmo:ActivationCode>323456789012</vmo:ActivationCode>
              </vmo:Voucher>
            </vmo:CheckStatusRequest>
          </soapenv:Body>
        </soapenv:Envelope>
        As you can see the requests above does not have the same headers. But even if I change the headers to match, as curl has that ability, curl is still able to send the requets correctly.
      5. org.jboss.ws.core.CommonSOAPFaultException: org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.
        	at org.jboss.ws.core.soap.EnvelopeBuilderDOM.build(EnvelopeBuilderDOM.java:93)
        	at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:280)
        	at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:195)
        	at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:154)
        	at org.springframework.ws.transport.AbstractWebServiceConnection.receive(AbstractWebServiceConnection.java:86)
        	at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:86)
        	at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
        	at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230)
        	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
        	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
        	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
        	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
        	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
        	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
        	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
        	at java.lang.Thread.run(Thread.java:619
        Any idea what might cause this error?