简体   繁体   English

如何测试webservice / WSDL

[英]How to test a webservice / WSDL

I have generated this WSDL file... 我已经生成了这个WSDL文件......

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.6 in JDK 6. -->
<definitions targetNamespace="http://math/" name="MathServicesService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://math/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <types>
    <xsd:schema>
      <xsd:import namespace="http://math/" schemaLocation="MathServicesService_schema1.xsd"/>
    </xsd:schema>
  </types>
  <message name="addTwoInts">
    <part name="parameters" element="tns:addTwoInts"/>
  </message>
  <message name="addTwoIntsResponse">
    <part name="parameters" element="tns:addTwoIntsResponse"/>
  </message>
  <message name="multiplyTwoFloats">
    <part name="parameters" element="tns:multiplyTwoFloats"/>
  </message>
  <message name="multiplyTwoFloatsResponse">
    <part name="parameters" element="tns:multiplyTwoFloatsResponse"/>
  </message>
  <portType name="MathServices">
    <operation name="addTwoInts">
      <input message="tns:addTwoInts"/>
      <output message="tns:addTwoIntsResponse"/>
    </operation>
    <operation name="multiplyTwoFloats">
      <input message="tns:multiplyTwoFloats"/>
      <output message="tns:multiplyTwoFloatsResponse"/>
    </operation>
  </portType>
  <binding name="MathServicesPortBinding" type="tns:MathServices">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <operation name="addTwoInts">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
    <operation name="multiplyTwoFloats">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>
  <service name="MathServicesService">
    <port name="MathServicesPort" binding="tns:MathServicesPortBinding">
      <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
    </port>
  </service>
</definitions>

from this class... 从这堂课......

package math;

import javax.jws.WebService;

@WebService
public class MathServices {

    public int addTwoInts(int int1, int int2){
        return int1+int2;
    }

    public float multiplyTwoFloats(float float1, float float2){
        return float1 * float2;
    }
}

How can I test to see if this webservice is working properly using the WSDL? 如何使用WSDL测试此Web服务是否正常工作? I don't understand how the functionality ( int1+int2 and float1*float2 ) translates to the XML. 我不明白功能( int1+int2float1*float2 )如何转换为XML。 All I see in the WSDL are what translate to method names and parameter names. 我在WSDL中看到的只是转换为方法名称和参数名称的内容。 I don't see where the math goes on. 我没看到数学在哪里。 :/ :/

That said, where do the parameters come from when using the webservice? 也就是说,使用Web服务时参数来自哪里? How do you even use the webservice? 你如何使用网络服务? Can I just use it through my browser? 我可以通过浏览器使用它吗?

For soap you can use SoapUI. 对于肥皂,你可以使用SoapUI。 See http://www.soapui.org/ . http://www.soapui.org/

您可以使用SoapUI测试WSDL。

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

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