Forum Discussion

mclam88's avatar
mclam88
New Contributor
8 years ago
Solved

always get bad request from http://www.w3schools.com/xml/tempconvert.asmx?WSDL

I'm following a very good tutorial on web service (http://ayazroomy-java.blogspot.ca/2013/07/java-web-service-tutorial-with-soap-ui.html) but keep getting bad request from http://www.w3schools.com/xm...
  • mclam88's avatar
    mclam88
    8 years ago

    hi Rao. Thanks for looking into my question.

     

    I too was able to open the wsdl in browser and import to a new SoapUI 5.2.1 project.

     

    • Below was the raw error message regardless of which request I submitted:

     HTTP/1.1 400 Bad Request
    Cache-Control: private,public
    Content-Type: text/xml; charset=utf-8
    Date: Thu, 02 Jun 2016 16:40:17 GMT
    Server: Microsoft-IIS/7.5
    X-AspNet-Version: 4.0.30319
    X-Powered-By: ASP.NET
    Content-Length: 0
    Accept-Ranges: none
    Via: 1.1 .....priv:8080
    Connection: keep-alive

     

    • Example of generated request:

     <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:x/="http://www.w3schools.com/xml/">
       <soapenv:Header/>
       <soapenv:Body>
          <x/:CelsiusToFahrenheit>
             <!--Optional:-->
             <x/:Celsius>212</x/:Celsius>
          </x/:CelsiusToFahrenheit>
       </soapenv:Body>
    </soapenv:Envelope>

  • nmrao's avatar
    nmrao
    8 years ago

    Oh ok.

     

    Yes, there is a problem.

     

    You will come to know if you validate the request using Alt+v

     

    • line -1: error: Unexpected character encountered (lex state 10): '/'
    • line 1: Unexpected character encountered (lex state 10): '/'

     

    Here is the change you needed.

     

     

    Request:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:x="http://www.w3schools.com/xml/">
       <soapenv:Header/>
       <soapenv:Body>
          <x:CelsiusToFahrenheit>
             <x:Celsius>212</x:Celsius>
          </x:CelsiusToFahrenheit>
       </soapenv:Body>
    </soapenv:Envelope>

    And you would get Response this time:

     

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <soap:Body>
          <CelsiusToFahrenheitResponse xmlns="http://www.w3schools.com/xml/">
             <CelsiusToFahrenheitResult>413.6</CelsiusToFahrenheitResult>
          </CelsiusToFahrenheitResponse>
       </soap:Body>
    </soap:Envelope>

    Issue is with namespace with special character

    changed it from

    xmlns:x/="http://www.w3schools.com/xml/"

    to

    xmlns:x="http://www.w3schools.com/xml/

     

    and its references