You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Sigirisetty Surya Kiran (JIRA)" <ji...@apache.org> on 2007/03/21 06:28:32 UTC

[jira] Created: (AXIS2-2355) Axis2 SOAP API Impl Issue

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


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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-2355) Axis2 SOAP API Impl Issue

Posted by "sumedha rubasinghe (JIRA)" <ji...@apache.org>.
    [ 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-2355) Axis2 SOAP API Impl Issue

Posted by "Sigirisetty Surya Kiran (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sigirisetty Surya Kiran updated AXIS2-2355:
-------------------------------------------

    Attachment: disclaim.txt

Thanks Sumedha!



> 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
>         Attachments: disclaim.txt
>
>
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Resolved: (AXIS2-2355) Axis2 SOAP API Impl Issue

Posted by "sumedha rubasinghe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

sumedha rubasinghe resolved AXIS2-2355.
---------------------------------------

    Resolution: Fixed

Fixed in Axis 1.2. See my previous comment for details.

> 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
>         Attachments: disclaim.txt
>
>
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Assigned: (AXIS2-2355) Axis2 SOAP API Impl Issue

Posted by "Davanum Srinivas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Davanum Srinivas reassigned AXIS2-2355:
---------------------------------------

    Assignee: sumedha rubasinghe

> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org