मेरे पास एक तृतीय पक्ष webservice है जिसके लिए मैं wsimport का उपयोग कर क्लाइंट उत्पन्न करता हूं। Webservice के लिए प्रत्येक कॉल सफलतापूर्वक पूर्ण हो जाती है, लेकिन प्रतिक्रिया ऑब्जेक्ट जो मुझे वापस मिलती है, उसके सभी फ़ील्ड शून्य हो जाते हैं। नेटवर्क की निगरानी करना मैं देख सकता हूं कि तार पर प्रतिक्रिया संदेश में सभी एक्सएमएल तत्वों में उनके मूल्य हैं, इसलिए ऑब्जेक्ट में इसमें गैर-शून्य डेटा होना चाहिए। साथ ही, पुराने अक्ष 1 के साथ उत्पन्न एक ही सेवा के लिए एक ग्राहक और उसी डेटा के साथ बुलाया गया एक गैर-खाली प्रतिक्रिया देता है। कोई विचार क्या हो रहा है? (यदि इससे कोई फर्क पड़ता है तो मैं जेएक्सबी के मोक्सी के कार्यान्वयन का उपयोग कर रहा हूं)।मेरा जैक्स-डब्ल्यू webservice क्लाइंट केवल खाली ऑब्जेक्ट्स देता है
अद्यतन: मैं इसे कम करने में सक्षम हूं। Wsdl ऑब्जेक्ट को अपने नामस्थान में परिभाषित करता है, http://www.acme.com/ws
कहें। प्रतिक्रिया मैं सेवा से मिलता है
<?xml version="1.0" encoding="UTF-8"?>
... SOAP envelope ...
<ns1:opINFOWLResponse xmlns:ns1="http://www.acme.com/ws"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns1:responseINFOWL xsi:type="ns1:responseINFOWL">
<result>6003</result>
<ndserr/>
<transid>61437594</transid>
<descriptionerr>BLAH.</descriptionerr>
</ns1:responseINFOWL>
</ns1:opINFOWLResponse>
... SOAP closing tags ...
है और एक गैर अशक्त OpINFOWLResponse
जो सभी क्षेत्रों शून्य पर सेट के साथ एक गैर अशक्त responseINFOWL
वस्तु इर्द-गिर्द घूमती को unmarshalled है। सिर्फ मनोरंजन के लिए मैं ऊपर टुकड़ा unmarshal को (सोप भूमि के ऊपर अलग करना के बाद)
JAXBContext ctx = JAXBContext.newInstance(OpINFOWLResponse.class);
Unmarshaller u = ctx.createUnmarshaller();
OpINFOWLResponse o = (OpINFOWLResponse) u.unmarshal(new StringReader(theSnippetAbove));
ResponseINFOWL w = o.getResponseINFOWL();
लाइनों के एक जोड़े लेखन की कोशिश की है और मैं एक ही परिणाम मिलता है। यदि मैं ऊपर एक्सएमएल को
<?xml version="1.0" encoding="UTF-8"?>
<ns1:opINFOWLResponse xmlns:ns1="http://www.acme.com/ws"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns1:responseINFOWL xsi:type="ns1:responseINFOWL">
<ns1:result>6003</ns1:result>
<ns1:ndserr/>
<ns1:transid>61437594</ns1:transid>
<ns1:descriptionerr>BLAH.</ns1:descriptionerr>
</ns1:responseINFOWL>
</ns1:opINFOWLResponse>
सब कुछ ठीक काम करता है। ओह।
अद्यतन (फिर): दोनों JAXB-आरआई और Moxy के साथ भी यही व्यवहार। अभी भी पता नहीं है कि क्या गलत है।
अद्यतन (सितम्बर 9): नीचे के बारे में नाम स्थान योग्यता के गलत होने के सुझाव दिलचस्प है, लेकिन मैं माना wsimport चीजों को सही मिलेगा। वैसे भी, यह मेरा package-info.java
@XmlSchema(
namespace = "http://www.acme.com/ws",
elementFormDefault = XmlNsForm.QUALIFIED)
package it.sky.guidaTv.service.remote;
import javax.xml.bind.annotation.XmlSchema;
import javax.xml.bind.annotation.XmlNsForm;
है और इस ResponseINFOWL
वर्ग
/*
* <p>Java class for responseINFOWL complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="responseINFOWL">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="result" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="descriptionerr" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="transid" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="ndserr" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="wallet" type="{http://www.acme.com/ws}t_wallet" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "responseINFOWL", propOrder = {
"result", "descriptionerr", "transid", "ndserr", "wallet" })
public class ResponseINFOWL {
@XmlElement(required = true)
protected String result;
@XmlElement(required = true)
protected String descriptionerr;
@XmlElement(required = true)
protected String transid;
protected String ndserr;
protected TWallet wallet;
// getters, setters and all.
}
मैं package-info
में नामस्थान लेकिन अभी भी कोई खुशी के साथ एक सा खेलने की कोशिश की है के प्रासंगिक हिस्सा है।
क्या आप संदेश और कक्षाओं से नमूने प्रदान कर सकते हैं? यह मैपिंग में मिस्चैच कहां निर्धारित करने में मदद करेगा। –
शायद मैं उपयुक्त रूप से अनामित wsdl फ़ाइल और टेस्ट क्लास पोस्ट कर सकता हूं, मेरे मामले में बाकी सबकुछ wsimport द्वारा उत्पन्न होता है। मजेदार बात यह है कि एक ही तीसरे पक्ष की अन्य सेवाएं ठीक काम करती हैं। – agnul