[ https://issues.apache.org/jira/browse/AXIS2-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12498736 ]
sumedha rubasinghe commented on AXIS2-2355: ------------------------------------------- Hi, I tested the code you have provided using <b>Axis 1.2 released </b> version. Axis 1.2 contains an improved SAAJ implementation, compared to Axis 1.1.1. Please take a note of positioning of the line 'body.addChildElement(op);' with respective to your code. import javax.xml.soap.MessageFactory; import javax.xml.soap.Name; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPConnection; import javax.xml.soap.SOAPConnectionFactory; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPFactory; import javax.xml.soap.SOAPMessage; public class HRServiceClient { public static void main(String[] args) throws Exception { SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance(); SOAPConnection sConn = scf.createConnection(); MessageFactory mf = MessageFactory.newInstance(); SOAPMessage msg = mf.createMessage(); SOAPBody body = msg.getSOAPBody(); SOAPFactory soapFactory = SOAPFactory.newInstance(); Name bn = soapFactory.createName("getEmployee", "ns1", "http://types.wsdl.custom.ws.ssk.com/xsd"); SOAPElement op = soapFactory.createElement(bn); Name pn = soapFactory.createName("p1", "ns1", "http://types.wsdl.custom.ws.ssk.com/xsd"); SOAPElement p1 = soapFactory.createElement(pn); //1.doesnt work //******************* I have uncommented the following line p1.addTextNode("1"); //2.doesnt work //SOAPElement val = p1.addTextNode("1"); //p1.addChildElement(val); //3.doesnt work //p1.setValue("1"); //4.doesnt work //p1.setNodeValue("1"); op.addChildElement(p1); // ********* take a note of positioning of following line with respective to your code body.addChildElement(op); java.net.URL endpoint = new URL( "http://localhost:8080/axis2/services/HRService"); msg.writeTo(System.out); System.out.println(); System.out.println(); SOAPMessage response = sConn.call(msg, endpoint); response.writeTo(System.out); } } With the above change, I was able to get the following output. <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body xmlns:ns1="http://types.wsdl.custom.ws.ssk.com/xsd"> <ns1:getEmployee xmlns:axis2ns2="http://types.wsdl.custom.ws.ssk.com/xsd"> <ns1:p1 xmlns:axis2ns3="http://types.wsdl.custom.ws.ssk.com/xsd">1</ns1:p1> </ns1:getEmployee> </soapenv:Body> </soapenv:Envelope> I suppose this is the output your expecting. > Axis2 SOAP API Impl Issue > ------------------------- > > Key: AXIS2-2355 > URL: https://issues.apache.org/jira/browse/AXIS2-2355 > Project: Axis 2.0 (Axis2) > Issue Type: Bug > Components: kernel > Affects Versions: 1.1.1 > Environment: Axis2-1.1.1, tomcat-5.5.20 > Reporter: Sigirisetty Surya Kiran > Assigned To: sumedha rubasinghe > > I wrote a client code for accessing a simple web service. But SOAP request > generated by axis2-saaj-1.1.1.jar seems to be having problem. > I'm not able to add a text node to the ws operation element. > package com.ssk.ws.custom.wsdl.types; > import java.net.URL; > import javax.xml.soap.MessageFactory; > import javax.xml.soap.Name; > import javax.xml.soap.SOAPBody; > import javax.xml.soap.SOAPConnection; > import javax.xml.soap.SOAPConnectionFactory; > import javax.xml.soap.SOAPElement; > import javax.xml.soap.SOAPFactory; > import javax.xml.soap.SOAPMessage; > public class HRServiceClient { > public static void main(String[] args) throws Exception { > SOAPConnectionFactory scf = > SOAPConnectionFactory.newInstance(); > SOAPConnection sConn = scf.createConnection(); > MessageFactory mf = MessageFactory.newInstance(); > SOAPMessage msg = mf.createMessage(); > SOAPBody body = msg.getSOAPBody(); > SOAPFactory soapFactory = SOAPFactory.newInstance(); > Name bn = soapFactory.createName("getEmployee", > "ns1", "http://types.wsdl.custom.ws.ssk.com/xsd"); > SOAPElement op = soapFactory.createElement(bn); > body.addChildElement(op); > Name pn = soapFactory.createName("p1", > "ns1", > "http://types.wsdl.custom.ws.ssk.com/xsd"); > SOAPElement p1 = soapFactory.createElement(pn); > //1.doesnt work > //p1.addTextNode("1"); > //2.doesnt work > //SOAPElement val = p1.addTextNode("1"); > //p1.addChildElement(val); > //3.doesnt work > //p1.setValue("1"); > //4.doesnt work > p1.setNodeValue("1"); > op.addChildElement(p1); > java.net.URL endpoint = new URL( > "http://localhost:8080/axis2/services/HRService"); > msg.writeTo(System.out); > System.out.println(); > System.out.println(); > SOAPMessage response = sConn.call(msg, endpoint); > response.writeTo(System.out); > } > } > <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> > <soapenv:Header /> > <soapenv:Body xmlns:ns1="http://types.wsdl.custom.ws.ssk.com/xsd"> > <ns1:getEmployee > xmlns="http://types.wsdl.custom.ws.ssk.com/xsd" /> > </soapenv:Body> > </soapenv:Envelope> > Regards, > sigirisetti -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]