Frage

I have a Java class with a method exposed as a webservice method. Below is my Java class.

    @WebService
    public class TestService{

        public String testMethod(InputVO input) {

        }
    }

        public class InputVO{
           private Data data;

        }

        public class Data{
            private String xmlData;
        }

Now in my InputVO, I've a Data field which has a String xmlData.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:svc="http://test.svc.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <svc:testMethod>
         <arg0>
             <data>
               <!-- ANY XML CONTENT-->
            </data>
         </arg0>
      </svc:service>
   </soapenv:Body>
</soapenv:Envelope>

This is the structure of the Input XML file that my service expects. Inside the data element, I should be able to pass any XML content. Now in my service's testMethod, I should get this data in the XML format in xmlData element of Data object. I've set for the content inside data in the xsd file of my wsdl.

 <xs:complexType name="data">
    <xs:sequence>
      <xs:any/>
    </xs:sequence>
  </xs:complexType>

But when I check my xmlData field in InputVO, it is coming as null. How do I set the complete String XML data into xmlData field? Kindly help me.

War es hilfreich?

Lösung

Please check whether your classes are properly annotated, seems some XML annotation are missing.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top