May12
May12

Reputation: 2520

How to remove the "new" prefix from several attributes of the element in the request to the SOAP service?

I have a wsdl. Using wsdl2java i have created java classes and add realization. After that i created project in SOAP UI i receive the next xml for request: enter image description here

The problem is that i have hardcoded client which will use one of operation of this web sevice and the client will not work if new prefix will exist. How to remove new prefix from login and password attributes of AuthData element?

UPDATE

When i call web-service like that:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sin="http://my.comp/2010/webservice/Service" xmlns:new="http://www.webservice.namespace">
   <soapenv:Header/>
   <soapenv:Body>
      <sin:AuthData>
         <!--Optional:-->
         <new:login>121212</new:login>
         <!--Optional:-->
         <new:password>12121</new:password>
      </sin:AuthData>
   </soapenv:Body>
</soapenv:Envelope>

it works fine. But when i delete prefic new i receive thw mistake:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Client</faultcode>
         <faultstring>Unmarshalling Error: unexpected element (uri:"", local:"login"). Expected elements are &lt;{http://new.webservice.namespace}login>,&lt;{http://new.webservice.namespace}password></faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

As i said the problem is than cl;ient can't send request with new prefix.

Upvotes: 1

Views: 966

Answers (1)

May12
May12

Reputation: 2520

Perfect day: ask a question and answer himself. Some time later. In my case i need to correct package-info.java class and change elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) to UNQUALIFIED in it. These problems could have been avoided if during the build classes are generate automatically by jaxb2-maven-plugin (whuch in my case i can not use due to project structure).

Upvotes: 1

Related Questions