please help me out for the below problem, i am trying since long time(3 weeks) but not able to get the proper resolution.I have to complete it ASAP ,as my so many webservice output depends on the custom return string.
I have written java code using javax.jws.
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding.Use;
String returnStr = null;
String responseCodeStart = "<responseCode>";
String responseCodeEnd = "</responseCode>";
String responseMessageStart = "<responseMessage>";
String responseMessageEnd = "</responseMessage>";
Return Custom String in JAVA to SOAP response/Output String :::::::::
returnStr = "\r\n" + responseCodeStart + "1000" + responseCodeEnd + "\r\n" + responseMessageStart + "Registration successful>>" + responseMessageEnd + "\r\n";
Problem :
1) I am getting (<) tag instead of (<)
2) I am getting ([CDATA[[) tag in response.
SOAP RESPONSE :
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:registerUserResponse xmlns:ns2="http://impl.timecapsule.com/">
<return><responseCode>1102</responseCode>
<responseMessage> [!CDATA[[Please provide username] </responseMessage></return>
</ns2:registerUserResponse>
</soap:Body>
</soap:Envelope>
*Resolution needed:*
1) < to remove
2) CDATA to remove
I want to retrieve it as XML object instead of String using java code.
THANKS
Use a Framework, if you want to provide or consume a webservice via SOAP.
You don’t have to use any starting-tags or end-tags, the framework will handle this.
If you return a String (not a number inside a class), the encodings are correct. You return a String with special encoded Chars. They HAVE to be encoded this way. otherwise you will create malformed XML.
javax.jws Tutorial at Oracle
Webservice-Tutorial