如何在netbeans中使用wsdl生成的代码(jax-ws)发送请求

时间:2015-10-28 07:30:10

标签: java wsdl

Hai需要帮助我尝试用步骤创建wsdl客户端:右键单击我的项目---> New ----->网络服务客户端--->我在我的计算机中选择了我现有的wsdl文件,然后我在我的项目中生成了代码,如下图所示,并在输出控制台中得到一些警告,如何使用生成的代码向服务器发送请求???关于输出控制台,当我导入wsdl文件到项目时,我做错了吗?

这是我生成的代码片段:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ExecutePrepaidStatusRq", propOrder = {
    "msisdnDealer",
    "msisdnSP",
    "username",
    "password",
    "switchId",
    "merchantId"
})
public class ExecutePrepaidStatusRq {

    @XmlElement(required = true)
    protected String msisdnDealer;
    @XmlElement(required = true)
    protected String msisdnSP;
    @XmlElement(required = true)
    protected String username;
    @XmlElement(required = true)
    protected String password;
    protected String switchId;
    protected String merchantId;

enter image description here

这是我的错误消息:

parsing WSDL...

[WARNING] EmptyTargetNamespace: In schema document 'http://dummy.pseudo-schema#schema2', the value of the 'targetNamespace' attribute cannot be an empty string.
  line 1 of http://dummy.pseudo-schema#schema2

[WARNING] src-resolve: Cannot resolve the name 'types:Header' to a(n) 'element declaration' component.
  line 7 of http://dummy.pseudo-schema#schema2

[WARNING] src-resolve: Cannot resolve the name 'types:PrepaidStatusRs' to a(n) 'element declaration' component.
  line 8 of http://dummy.pseudo-schema#schema2

[WARNING] Ignoring operation "ExecutePrepaidRegistrationRq": more than one part bound to body
  line 175 of file:/C:/Users/Achilles/Documents/NetBeansProjects/ClientPrepaidXL/xml-resources/web-service-references/cpCustomerOnBoarding/wsdl/cpCustomerOnBoarding.wsdl

[WARNING] Ignoring operation "ExecutePrepaidStatusRq": more than one part bound to body
  line 186 of file:/C:/Users/Achilles/Documents/NetBeansProjects/ClientPrepaidXL/xml-resources/web-service-references/cpCustomerOnBoarding/wsdl/cpCustomerOnBoarding.wsdl

[WARNING] Port "PublicEP" does not contain any usable operations
  line 129 of file:/C:/Users/Achilles/Documents/NetBeansProjects/ClientPrepaidXL/xml-resources/web-service-references/cpCustomerOnBoarding/wsdl/cpCustomerOnBoarding.wsdl

[WARNING] Service "Service" does not contain any usable ports. try running wsimport with -extension switch.
  line 128 of file:/C:/Users/Achilles/Documents/NetBeansProjects/ClientPrepaidXL/xml-resources/web-service-references/cpCustomerOnBoarding/wsdl/cpCustomerOnBoarding.wsdl

Generating code...
clientprepaidxl\ExecutePrepaidRegistrationRq.java
clientprepaidxl\ExecutePrepaidRegistrationRqResponse.java

这是我的wsdl文件:

<?xml version="1.0" encoding="UTF-8"?>
<!--Created by TIBCO WSDL-->
<wsdl:definitions xmlns:ns2="http://schemas.xl.co.id/GenericFault/V1.0" xmlns:ns1="http://schemas.xl.co.id/esb/payloads/cpCustomerOnBoarding/V1.0" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://xmlns.example.com/1428655888834" xmlns:ns0="http://schemas.xl.co.id/SOAR/Component/HeaderRequest/V1_0" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="Untitled" targetNamespace="http://xmlns.example.com/1428655888834">
    <wsdl:types>
        <xs:schema xmlns="http://schemas.xl.co.id/esb/payloads/cpCustomerOnBoarding/V1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://schemas.xl.co.id/esb/payloads/cpCustomerOnBoarding/V1.0">
            <xs:complexType name="ExecutePrepaidRegistrationRq">
                <xs:sequence>
                    <xs:element ref="ns1:msisdnDealer"/>
                    <xs:element ref="ns1:msisdnSP"/>
                    <xs:element ref="ns1:Name"/>
                    <xs:element ref="ns1:IdType"/>
                    <xs:element ref="ns1:IdNumber"/>
                    <xs:element ref="ns1:Street1"/>
                    <xs:element ref="ns1:POB"/>
                    <xs:element ref="ns1:DOB"/>
                    <xs:element ref="ns1:OptIn"/>
                    <xs:element ref="ns1:username"/>
                    <xs:element ref="ns1:password"/>
                    <xs:element ref="ns1:secCode"/>
                    <xs:element ref="ns1:merchantId"/>
                    <xs:element minOccurs="0" ref="ns1:Street2"/>
                    <xs:element minOccurs="0" ref="ns1:City"/>
                    <xs:element minOccurs="0" ref="ns1:Province"/>
                    <xs:element minOccurs="0" ref="ns1:Postcode"/>
                    <xs:element minOccurs="0" ref="ns1:Gender"/>
                    <xs:element minOccurs="0" ref="ns1:Channel"/>
                    <xs:element minOccurs="0" ref="ns1:switchId"/>
                </xs:sequence>
            </xs:complexType>
            <xs:complexType name="ExecutePrepaidRegistrationRs">
                <xs:sequence>
                    <xs:element ref="ns1:Status"/>
                </xs:sequence>
            </xs:complexType>
            <xs:complexType name="ExecutePrepaidStatusRq">
                <xs:sequence>
                    <xs:element ref="ns1:msisdnDealer"/>
                    <xs:element ref="ns1:msisdnSP"/>
                    <xs:element ref="ns1:username"/>
                    <xs:element ref="ns1:password"/>
                    <xs:element minOccurs="0" ref="ns1:switchId"/>
                    <xs:element minOccurs="0" ref="ns1:merchantId"/>
                </xs:sequence>
            </xs:complexType>
            <xs:complexType name="PrepaidStatusRs">
                <xs:sequence>
                    <xs:element ref="ns1:msisdnSP"/>
                    <xs:element ref="ns1:PrepaidStatus"/>
                    <xs:element ref="ns1:respCode"/>
                    <xs:element ref="ns1:respMessage"/>
                </xs:sequence>
            </xs:complexType>
            <xs:element name="Channel" type="xs:string"/>
            <xs:element name="City" type="xs:string"/>
            <xs:element name="DOB" type="xs:string"/>
            <xs:element name="ExecutePrepaidRegistrationRq" type="ns1:ExecutePrepaidRegistrationRq"/>
            <xs:element name="ExecutePrepaidRegistrationRs" type="ns1:ExecutePrepaidRegistrationRs"/>
            <xs:element name="ExecutePrepaidStatusRq" type="ns1:ExecutePrepaidStatusRq"/>
            <xs:element name="Gender" type="xs:string"/>
            <xs:element name="IdNumber" type="xs:string"/>
            <xs:element name="IdType" type="xs:string"/>
            <xs:element name="Name" type="xs:string"/>
            <xs:element name="OptIn" type="xs:string"/>
            <xs:element name="POB" type="xs:string"/>
            <xs:element name="Postcode" type="xs:string"/>
            <xs:element name="PrepaidStatus" type="xs:string"/>
            <xs:element name="PrepaidStatusRs" type="ns1:PrepaidStatusRs"/>
            <xs:element name="Province" type="xs:string"/>
            <xs:element name="Status" type="xs:string"/>
            <xs:element name="Street1" type="xs:string"/>
            <xs:element name="Street2" type="xs:string"/>
            <xs:element name="merchantId" type="xs:string"/>
            <xs:element name="msisdnDealer" type="xs:string"/>
            <xs:element name="msisdnSP" type="xs:string"/>
            <xs:element name="password" type="xs:string"/>
            <xs:element name="respCode" type="xs:string"/>
            <xs:element name="respMessage" type="xs:string"/>
            <xs:element name="secCode" type="xs:string"/>
            <xs:element name="switchId" type="xs:string"/>
            <xs:element name="username" type="xs:string"/>
        </xs:schema>
        <xs:schema xmlns:hr="http://schemas.xl.co.id/SOAR/Component/HeaderRequest/V1_0" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://schemas.xl.co.id/SOAR/Component/HeaderRequest/V1_0">
            <xs:complexType name="Header">
                <xs:sequence>
                    <xs:element minOccurs="0" ref="hr:ReqID"/>
                </xs:sequence>
            </xs:complexType>
            <xs:complexType name="HeaderRequestType">
                <xs:sequence>
                    <xs:element name="applicationID" type="xs:string"/>
                    <xs:element name="applicationSubID" type="xs:string"/>
                    <xs:element name="encryptionKey" type="xs:string"/>
                    <xs:element name="encryptedText" type="xs:string"/>
                    <xs:element minOccurs="0" name="touchpoint" type="xs:string"/>
                    <xs:element minOccurs="0" name="requestID" type="xs:string"/>
                    <xs:element name="msisdn" type="xs:string"/>
                    <xs:element name="serviceID" type="xs:string"/>
                    <xs:element minOccurs="0" name="IMEI" type="xs:string"/>
                    <xs:element minOccurs="0" name="CGI" type="xs:string"/>
                    <xs:element minOccurs="0" name="IMSI" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
            <xs:element name="Header" type="hr:Header"/>
            <xs:element name="HeaderRequest" type="hr:HeaderRequestType"/>
            <xs:element name="ReqID" type="xs:string"/>
        </xs:schema>
        <xs:schema xmlns:genFault="http://schemas.xl.co.id/GenericFault/V1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://schemas.xl.co.id/GenericFault/V1.0">
            <xs:annotation>
                <xs:documentation>MsgCode = ErrorCode, e.g. Taken from Error Code System -&gt; BW-JDBC-100031
Message = ErrorMessage, e.g. Taken from Error Message - &gt; JDBC Connection Time Out
Process Stack = Hierarcy processes
Stack Trace = BW Stack Trace
Fault Actor  (Optional)
                </xs:documentation>
            </xs:annotation>
            <xs:complexType name="GenericFault">
                <xs:sequence>
                    <xs:element minOccurs="0" name="MsgCode" type="xs:string"/>
                    <xs:element minOccurs="0" name="Message" type="xs:string"/>
                    <xs:element minOccurs="0" name="ProcessStack" type="xs:string"/>
                    <xs:element minOccurs="0" name="StackTrace" type="xs:string"/>
                    <xs:element minOccurs="0" name="FaultActor" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
            <xs:element name="GenericFault" type="genFault:GenericFault"/>
        </xs:schema>
    </wsdl:types>
    <wsdl:service name="Service">
        <wsdl:port binding="tns:PublicEPBinding" name="PublicEP">
            <soap:address location="http://localhost:11111/BusinessServices/cpCustomerOnBoarding/V1.0"/>
        </wsdl:port>
    </wsdl:service>
    <wsdl:portType name="PortType">
        <wsdl:operation name="ExecutePrepaidRegistrationRq">
            <wsdl:input message="tns:ExecutePrepaidRegistrationRq"/>
            <wsdl:output message="tns:ExecutePrepaidRegistrationRs"/>
            <wsdl:fault message="tns:GenericFault" name="fault1"/>
        </wsdl:operation>
        <wsdl:operation name="ExecutePrepaidStatusRq">
            <wsdl:input message="tns:ExecutePrepaidStatusRq"/>
            <wsdl:output message="tns:PrepaidStatusRs"/>
            <wsdl:fault message="tns:GenericFault" name="fault1"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="PublicEPBinding" type="tns:PortType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="ExecutePrepaidRegistrationRq">
            <soap:operation soapAction="ExecutePrepaidRegistrationRq" style="document"/>
            <wsdl:input>
                <soap:body parts="Header ExecutePrepaidRegistrationRq" use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body parts="Header ExecutePrepaidRegistrationRs" use="literal"/>
            </wsdl:output>
            <wsdl:fault name="fault1">
                <soap:fault name="fault1" use="literal"/>
            </wsdl:fault>
        </wsdl:operation>
        <wsdl:operation name="ExecutePrepaidStatusRq">
            <soap:operation soapAction="ExecutePrepaidStatusRq" style="document"/>
            <wsdl:input>
                <soap:body parts="Header ExecutePrepaidStatusRq" use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body parts="Header PrepaidStatusRs" use="literal"/>
            </wsdl:output>
            <wsdl:fault name="fault1">
                <soap:fault name="fault1" use="literal"/>
            </wsdl:fault>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:message name="ExecutePrepaidRegistrationRq">
        <wsdl:part element="ns0:Header" name="Header"/>
        <wsdl:part element="ns1:ExecutePrepaidRegistrationRq" name="ExecutePrepaidRegistrationRq"/>
    </wsdl:message>
    <wsdl:message name="ExecutePrepaidRegistrationRs">
        <wsdl:part element="ns0:Header" name="Header"/>
        <wsdl:part element="ns1:ExecutePrepaidRegistrationRs" name="ExecutePrepaidRegistrationRs"/>
    </wsdl:message>
    <wsdl:message name="GenericFault">
        <wsdl:part element="ns2:GenericFault" name="Fault"/>
    </wsdl:message>
    <wsdl:message name="ExecutePrepaidStatusRq">
        <wsdl:part element="ns0:Header" name="Header"/>
        <wsdl:part element="ns1:ExecutePrepaidStatusRq" name="ExecutePrepaidStatusRq"/>
    </wsdl:message>
    <wsdl:message name="PrepaidStatusRs">
        <wsdl:part element="ns0:Header" name="Header"/>
        <wsdl:part element="ns1:PrepaidStatusRs" name="PrepaidStatusRs"/>
    </wsdl:message>
</wsdl:definitions>

0 个答案:

没有答案