简体   繁体   English

如何使用NetBeans从wsdl中使用w3schools tempCnvertor Web服务?

[英]How do i consume the w3schools tempCnvertor webservice from the wsdl with netbeans?

I have been trying to consume the w3schools tempConvertor webservice from 我一直在尝试从以下位置使用w3schools tempConvertor Web服务

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

it gives me this warning messages just before generating the client classes 它在生成客户端类之前给了我这个警告消息

parsing WSDL... 解析WSDL ...

[WARNING] SOAP port "TempConvertSoap12": uses a non-standard SOAP 1.2 binding. [警告] SOAP端口“ TempConvertSoap12”:使用非标准的SOAP 1.2绑定。 line 147 of file:/C:/Users/Bigesta/Documents/NetBeansProjects/JavaebServiceDemo/xml-resources/web-service-references/tempconvert/wsdl/www.w3schools.com/xml/tempconvert.asmx.wsdl 文件的第147行:/ 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 [警告]端口“ TempConvertHttpPost”不是SOAP端口,它没有soap:文件的地址行:/ 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. [警告]端口“ TempConvertHttpPost”:不是标准的SOAP端口。 The generated artifacts may not work with JAX-WS runtime. 生成的工件可能不适用于JAX-WS运行时。 line 150 of file:/C:/Users/Bigesta/Documents/NetBeansProjects/JavaebServiceDemo/xml-resources/web-service-references/tempconvert/wsdl/www.w3schools.com/xml/tempconvert.asmx.wsdl 文件的第150行:/ 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) 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 \\ FahrenheitToCahs \\ java_www_ss \\ www_sw \\ s3 \\ s_java_www_sw \\ s3 \\ s3 \\ s_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将9个文件复制到C:\\ Users \\ Bigesta \\ Documents \\ NetBeansProjects \\ JavaebServiceDemo build \\ generate-sources \\ jax-ws BUILD SUCCESSFUL(总时间:8秒)

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 线程“主”中的异常com.sun.xml.internal.ws.client.ClientTransportException:服务器发送了HTTP状态代码301:在com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode永久移动(HttpTransportPipe.java:310)位于com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:259)位于com.sun.xml.internal.ws.transport.http.client位于com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:130)的.HttpTransportPipe.process(HttpTransportPipe.java:217) .com.sun.xml.internal.ws.api.pipe.Fiber .__ doRun(Fiber.java:1121)的.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95)在com.sun.xml.internal.ws.api.pipe .com.sun.xml.internal.ws.api.pipe上的.Fiber._doRun(Fiber.java:1035).com.sun.xml.internal.ws.api.pipe上的.Fiber.doRun(Fiber.java:1004) com.sun.xml.internal.ws.client.Stub.process(Stub)上的.Fiber.runSync(Fiber.java:862) .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) com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:178)的.java:448)com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler .java:93)com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub .java:147),位于com.sun.proxy。$ Proxy31.fahrenheitToCelsius(未知源),位于javaebservicedemo.JavaebServiceDemo.fahrenheitToCelsius(JavaebServiceDemo.java:26),位于javaebservicedemo.JavaebServiceDemo.main(JavaebServiceDemo.java:19)

How can i make it work? 我该如何运作?

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. 解析WSDL时,警告表明WSDL特别不遵循SOAP 1.2绑定约定:SOAP端口没有soap:address。 This WSDL maybe trying to support both SOAP 1.1 and 1.2 该WSDL可能试图同时支持SOAP 1.1和1.2

The response you are getting is 301: Moved Permanently which is trying to redirect you. 您得到的响应是301:永久移动 ,正在尝试重定向您。

There is an example here: https://www.w3schools.com/xml/tempconvert.asmx?op=FahrenheitToCelsius 这里有一个例子: 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. 但是,当我使用post示例时,出现500服务器错误,这不是一个好兆头。

To save time I recommend using a tool like SOAPUI to test and validate the service is working before creating your demo. 为了节省时间,我建议在创建演示之前使用SOAPUI之类的工具来测试和验证服务是否正常运行。 You could try and use a different service such as http://www.webservicex.net/ConvertTemperature.asmx?WSDL 您可以尝试使用其他服务,例如http://www.webservicex.net/ConvertTemperature.asmx?WSDL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM