文件1:Request.xsd
<?xml version="1.0" encoding="windows-1252" ?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://mypackage/type" elementFormDefault="qualified"
        xmlns:tns="http://mypackage/type/"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
        attributeFormDefault="unqualified">
    <complexType name="ValidateUserRequest">
        <sequence>
            <element name="userName" type="String"/>
            <element name="password" type="String"/>
        </sequence>
    </complexType>
</schema>文件2 Response.xsd:
<?xml version="1.0" encoding="windows-1252" ?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://mypackage/type" elementFormDefault="qualified"
        xmlns:tns="http://mypackage/type/"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/">
    <complexType name="ValidateUserResponse">
        <sequence>
            <element name="Result" type="String" nillable="true"/>
        </sequence>
    </complexType>
</schema>

解决方案 »

  1.   

    文件三validate.wsdl<definitions name="ValidateWebService" targetNamespace="http://mypackage/"
                 xmlns="http://schemas.xmlsoap.org/wsdl/"
                 xmlns:tns="http://mypackage/"
                 xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
                 xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
                 xmlns:tns0="http://mypackage/type/"
                 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
        <types>
            <schema xmlns="http://www.w3.org/2001/XMLSchema"
                    targetNamespace="http://mypackage/type/"
                    elementFormDefault="qualified"
                    xmlns:tns="http://mypackage/type/"
                    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/">
                <xsd:import namespace="http://mypackage/type/"
                            schemaLocation="Request.xsd"/>
                <xsd:import namespace="http://mypackage/type/"
                            schemaLocation="Response.xsd"/>        </schema>
        </types>
        <message name="validateRequest">
            <part name="req" type="tns0:ValidateUserRequest"/>
        </message>
        <message name="validateResponse">
            <part name="res" type="tns0:ValidateUserResponse"/>
        </message>
        <portType name="ValidateWebService">
            <operation name="validate">
                <input message="tns:validateRequest"/>
                <output message="tns:validateResponse"/>
            </operation>
        </portType>
        <binding name="bindMePort" type="tns:ValidateWebService">
            <soap:binding style="rpc"
                          transport="http://schemas.xmlsoap.org/soap/http"/>
            <operation name="validate">
                <soap:operation soapAction="http://mypackage//validate"/>
                <input>
                     <soap:body use="literal" namespace="http://mypackage/" parts="req"/>
                </input>
                <output>
                     <soap:body use="literal" namespace="http://mypackage/" parts="res"/>
                </output>
            </operation>
        </binding>
        <service name="ValidateWebService">
            <port name="AccessMe"
                  binding="tns:bindMePort">
                <soap:address location="http://qkong-cn.cn.oracle.com:80/ValidateWebService/AccessMe"/>
            </port>
        </service>
    </definitions>
      

  2.   

    try to create a new java web service through WSDL using above wsdl file,
    it mentioned
    "model error: type "{http://mypackage/type} ValidateuserResponse" not found."是我环境出问题了 还是文件写错了需要设置什么吗?我用的是jdeveloer
      

  3.   

    mistake1:
    targetNamespace="http://mypackage/type" should be targetNamespace="http://mypackage/type/"
      

  4.   

    Request.xsd、Response.xsd:
    targetNamespace="http://mypackage/type"
    改成
    targetNamespace="http://mypackage/type/"
    就可以