现在有这么一个WebService的地址:http://xxx.xxx.xxx.xxx:8080/OrderServerWS?wsdl
它里面提供了这么一个方法:PosMessage transact(PosMessage msg)
因为WebService里面方法参数是一个对象,那么我应该怎么调用?我没有此WebService对应的接口噢!
想了大半天,试了许多方法,都没有成功,不知道有大神知道不。
WebService的WSDL文件如下:<?xml version="1.0" encoding="UTF-8"?>
<definitions name="OrderServerWS" targetNamespace="http://thirdpart.service.dnapay/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://thirdpart.service.dnapay/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <types>
    <xsd:schema>
      <xsd:import namespace="http://thirdpart.service.dnapay/" schemaLocation="OrderServerWS_schema1.xsd"/>
    </xsd:schema>
  </types>
  <message name="transactResponse">
    <part name="return" type="tns:posMessage">
    </part>
  </message>
  <message name="transact">
    <part name="arg0" type="tns:posMessage">
    </part>
  </message>
  <portType name="IOrderServerWS">
    <operation name="transact" parameterOrder="arg0">
      <input message="tns:transact">
    </input>
      <output message="tns:transactResponse">
    </output>
    </operation>
  </portType>
  <binding name="OrderServerWSPortBinding" type="tns:IOrderServerWS">
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="transact">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal" namespace="http://thirdpart.service.dnapay/"/>
      </input>
      <output>
        <soap:body use="literal" namespace="http://thirdpart.service.dnapay/"/>
      </output>
    </operation>
  </binding>
  <service name="OrderServerWS">
    <port name="OrderServerWSPort" binding="tns:OrderServerWSPortBinding">
      <soap:address location="http://xxx.xxx.xxx.xxx:8080/OrderServerWS"/>
    </port>
  </service>
</definitions>
有大神知道吗?还请赐教啦。WebService我是第一次接触,麻烦各位大大多多指教噢。我应该用XFire还是Axis呢?非常感谢回复的各位,以及进来看小弟问题的各位。

解决方案 »

  1.   

    http://www.diybl.com/course/3_program/java/javajs/20090415/165030.html
      

  2.   

    xfire就不要去用了,要么axis2要么cxf他们都提供了wsdl2java工具,通过wsdl生成java客户端以方便调用
      

  3.   

    如果真的可以直接调的话 java 还安全吗?  感觉不可以调用吧 ,
      

  4.   

    要么生成客户端,要么自己写客户端拼报文用java发送,接收报文自己解析,就这么两种做法
      

  5.   

    这个简单啊 
    你找一个 CXF,AXIS生成以下客户端 WSDL2JAVA 就对了
    或者 如果你是用的JDK1.6以上版本  你可以直接使用JDK 自带的JAX-WS的wsimport命令 一下就生成客户端了 就OK了