1

I have been trying to consume the w3schools tempConvertor webservice from

https://www.w3schools.com/xml/tempconvert.asmx?WSDL

it gives me this warning messages just before generating the client classes

parsing WSDL...

[WARNING] SOAP port "TempConvertSoap12": uses a non-standard SOAP 1.2 binding. line 147 of file:/C:/Users/Bigesta/Documents/NetBeansProjects/JavaebServiceDemo/xml-resources/web-service-references/tempconvert/wsdl/www.w3schools.com/xml/tempconvert.asmx.wsdl

[WARNING] Port "TempConvertHttpPost" is not a SOAP port, it has no soap:address line 150 of file:/C:/Users/Bigesta/Documents/NetBeansProjects/JavaebServiceDemo/xml-resources/web-service-references/tempconvert/wsdl/www.w3schools.com/xml/tempconvert.asmx.wsdl

[WARNING] port "TempConvertHttpPost": not a standard SOAP port. The generated artifacts may not work with JAX-WS runtime. line 150 of file:/C:/Users/Bigesta/Documents/NetBeansProjects/JavaebServiceDemo/xml-resources/web-service-references/tempconvert/wsdl/www.w3schools.com/xml/tempconvert.asmx.wsdl

Generating code...

https\www_w3schools_com\xml\CelsiusToFahrenheit.java https\www_w3schools_com\xml\CelsiusToFahrenheitResponse.java https\www_w3schools_com\xml\FahrenheitToCelsius.java https\www_w3schools_com\xml\FahrenheitToCelsiusResponse.java https\www_w3schools_com\xml\ObjectFactory.java https\www_w3schools_com\xml\TempConvert.java https\www_w3schools_com\xml\TempConvertHttpPost.java https\www_w3schools_com\xml\TempConvertSoap.java https\www_w3schools_com\xml\package-info.java Copying 9 files to C:\Users\Bigesta\Documents\NetBeansProjects\JavaebServiceDemo\build\generated-sources\jax-ws BUILD SUCCESSFUL (total time: 8 seconds)

When ever i try to call the service i get this exceptions

Exception in thread "main" com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 301: Moved Permanently at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:310) at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:259) at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:217) at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:130) at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95) at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:1121) at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:1035) at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:1004) at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:862) at com.sun.xml.internal.ws.client.Stub.process(Stub.java:448) at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:178) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:93) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77) at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147) at com.sun.proxy.$Proxy31.fahrenheitToCelsius(Unknown Source) at javaebservicedemo.JavaebServiceDemo.fahrenheitToCelsius(JavaebServiceDemo.java:26) at javaebservicedemo.JavaebServiceDemo.main(JavaebServiceDemo.java:19)

How can i make it work?

Bigesta
  • 11
  • 3

1 Answers1

1

When the WSDL is parsed the warnings are stating that the WSDL is not following SOAP 1.2 binding conventions in particular: SOAP port has no soap:address. This WSDL maybe trying to support both SOAP 1.1 and 1.2

The response you are getting is 301: Moved Permanently which is trying to redirect you.

There is an example here: https://www.w3schools.com/xml/tempconvert.asmx?op=FahrenheitToCelsius

However, when I use the post example I get a 500 server error which isn't a good sign.

To save time I recommend using a tool like SOAPUI to test and validate the service is working before creating your demo. You could try and use a different service such as http://www.webservicex.net/ConvertTemperature.asmx?WSDL

Dan Hunter
  • 71
  • 5
  • Another simple ws that works at the time of writing: http://www.dneonline.com/calculator.asmx?wsdl – Manuel Jan 22 '20 at 15:02