आपके दूसरे संदेश में आपके पास एक स्पष्ट उपसर्ग घोषणा है और केवल उस नामस्थान में रैपर है, अन्य तत्व नामस्थान में नहीं हैं और माता-पिता से डिफ़ॉल्ट एक का वारिस नहीं करते हैं (xmlns
विशेषता गायब होने के कारण)।
जब आप लक्ष्य नामस्थान बदलते हैं तो कोड और संदेश प्रारूप में अंतर देखने के लिए यहां एक उदाहरण दिया गया है।
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://tempuri.org"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://tempuri.org"
name="CalculatorWS">
<wsdl:types>
<xs:schema targetNamespace="http://tempuri.org">
<xs:element name="add" type="tns:add" />
<xs:element name="addInput" type="tns:addInput" />
<xs:element name="addResponse" type="tns:addResponse" />
<xs:element name="addOutput" type="tns:addOutput" />
<xs:complexType name="add">
<xs:sequence>
<xs:element name="addInput" type="tns:addInput" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="addInput">
<xs:sequence>
<xs:element name="a" type="xs:int" />
<xs:element name="b" type="xs:int" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="addResponse">
<xs:sequence>
<xs:element name="addOutput" type="tns:addOutput" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="addOutput">
<xs:sequence>
<xs:element name="result" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="add">
<wsdl:part name="parameters" element="tns:add" />
</wsdl:message>
<wsdl:message name="addResponse">
<wsdl:part name="parameters" element="tns:addResponse" />
</wsdl:message>
<wsdl:portType name="CalculatorWS">
<wsdl:operation name="add">
<wsdl:input message="tns:add" />
<wsdl:output message="tns:addResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CalculatorWSPortBinding" type="tns:CalculatorWS">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<wsdl:operation name="add">
<soap:operation soapAction="http://tempuri.org/add" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CalculatorWSService">
<wsdl:port name="CalculatorWSPort" binding="tns:CalculatorWSPortBinding">
<soap:address location="http://localhost:8080/WebServices/CalculatorWS" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
इस तरह संदेशों को परिभाषित करता है:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tem="http://tempuri.org">
<soapenv:Body>
<tem:add>
<addInput>
<a>?</a>
<b>?</b>
</addInput>
</tem:add>
</soapenv:Body>
</soapenv:Envelope>
और:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tem="http://tempuri.org">
<soapenv:Body>
<tem:addResponse>
<addOutput>
<result>?</result>
</addOutput>
</tem:addResponse>
</soapenv:Body>
</soapenv:Envelope>
रैपर पर नामस्थान उपसर्ग देखें मैं इस के लिए एक बुनियादी डबल्यूएसडीएल इस्तेमाल करेंगे? ऐसा इसलिए है क्योंकि http://tempuri.org
नामस्थान में तत्व घोषित किए गए हैं जबकि अन्य नामस्थान में नहीं हैं और नहीं हैं।
आप नामस्थानों से सभी तत्वों को भी हटा सकते हैं।डबल्यूएसडीएल से लक्ष्य नाम स्थान पट्टी और यह इस तरह देखने के लिए मिलती है:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<add>
<addInput>
<a>?</a>
<b>?</b>
</addInput>
</add>
</soapenv:Body>
</soapenv:Envelope>
और:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<addResponse>
<addOutput>
<result>?</result>
</addOutput>
</addResponse>
</soapenv:Body>
</soapenv:Envelope>
में कोई उपसर्ग
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
name="CalculatorWS">
<wsdl:types>
<xs:schema>
<xs:element name="add" type="add" />
<xs:element name="addInput" type="addInput" />
<xs:element name="addResponse" type="addResponse" />
<xs:element name="addOutput" type="addOutput" />
<xs:complexType name="add">
<xs:sequence>
<xs:element name="addInput" type="addInput" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="addInput">
<xs:sequence>
<xs:element name="a" type="xs:int" />
<xs:element name="b" type="xs:int" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="addResponse">
<xs:sequence>
<xs:element name="addOutput" type="addOutput" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="addOutput">
<xs:sequence>
<xs:element name="result" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="add">
<wsdl:part name="parameters" element="add" />
</wsdl:message>
<wsdl:message name="addResponse">
<wsdl:part name="parameters" element="addResponse" />
</wsdl:message>
<wsdl:portType name="CalculatorWS">
<wsdl:operation name="add">
<wsdl:input message="add" />
<wsdl:output message="addResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CalculatorWSPortBinding" type="CalculatorWS">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<wsdl:operation name="add">
<soap:operation soapAction="http://tempuri.org/add" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CalculatorWSService">
<wsdl:port name="CalculatorWSPort" binding="CalculatorWSPortBinding">
<soap:address location="http://localhost:8080/WebServices/CalculatorWS" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
इस नए डबल्यूएसडीएल जैसे संदेश के अनुरूप होगा ये मामला।
अब दोनों WSDLs पर wsimport.exe
का उपयोग करें और आप लक्ष्य नामस्थान कि मैंने शुरू में के बारे में बात कर रहा था, अर्थात् इस से एक बदलाव देखेंगे:
@WebService(name = "CalculatorWS", targetNamespace = "http://tempuri.org")
public interface CalculatorWS {
@WebMethod(action = "http://tempuri.org/add")
@WebResult(name = "addOutput", targetNamespace = "")
@RequestWrapper(localName = "add", targetNamespace = "http://tempuri.org", className = "your.pack.age.Add")
@ResponseWrapper(localName = "addResponse", targetNamespace = "http://tempuri.org", className = "your.pack.age.AddResponse")
public AddOutput add(
@WebParam(name = "addInput", targetNamespace = "")
AddInput addInput);
}
इस के लिए :
@WebService(name = "CalculatorWS", targetNamespace = "")
public interface CalculatorWS {
@WebMethod(action = "http://tempuri.org/add")
@WebResult(name = "addOutput", targetNamespace = "")
@RequestWrapper(localName = "add", targetNamespace = "", className = "your.pack.age.Add")
@ResponseWrapper(localName = "addResponse", targetNamespace = "", className = "your.pack.age.AddResponse")
public AddOutput add(
@WebParam(name = "addInput", targetNamespace = "")
AddInput addInput);
}
नियंत्रण targetNamespace
और आप यह नियंत्रित करेंगे कि संदेश कैसा दिखता है।
आप किस ग्राहक का उपयोग करते हैं? jaxws? – Cris
आपके दो उदाहरण अलग हैं। पहले मामले में, नामस्थान 'GetPatientResultsRequest' और' रोगी पहचान ',' अवधि ', 'से' और 'से' तत्वों पर है। दूसरे उदाहरण में, यह केवल 'GetPatientResultsRequest' तत्व पर है। –
मुझे एक ही समस्या का सामना करना पड़ रहा है। कृपया मुझे बताएं कि क्या आप इस मुद्दे को हल करने में सक्षम थे ... –