You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by "M.Rajashekar" <Ra...@sun.com> on 2002/01/29 08:04:46 UTC

Problem with Sessions

Hi,

I have deployed  service with scope set to 'Session'. When I invoke this
service (The service just returns me the session id) , the session id
returned is always null. I am using iPalnet web Server and Apache SOAP
2.2 on Solaris 5.8.


root[sh]@wajra# java org.apache.soap.server.ServiceManagerClient
http://wajra.india.sun.com:85/soap/rpcrouter list
Deployed Services:
        urn:Hello
root[sh]@wajra# java org.apache.soap.server.ServiceManagerClient
http://wajra.india.sun.com:85/soap/rpcrouter query urn:Hello
<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
id="urn:Hello" checkMustUnderstands="false">
<isd:provider type="java" scope="Session" methods="sayHelloTo">
<isd:java class="com.iplanet.iabs.SOAPplugin.iabswebservice"
static="false"/>
</isd:provider>
</isd:service>


I am sending the snippet of code for Service as well as client.

service :

public class iabswebservice
{
   public String sayHelloTo(org.apache.soap.rpc.SOAPContext soapCtx,
String name)
  {
     HttpSession httpSess= (HttpSession)
soapCtx.getProperty(org.apache.soap.Constants.BAG_HTTPSESSION);
     String str = httpSess.getId();
     System.out.println("sayHelloTo(String name)");
     request.getSession(true);
     return "Hello " + name + ", How are you doing?" + "  , Your Session
ID is " +  str;
  }
}


client :

 public static void main(String[] args) throws Exception
                            {
                               if(args.length == 0)
                               {
                                  System.err.println("Usage: java
hello.Client [SOAP-router-URL] ");
                                  System.exit (1);
                               }

                               try
                               {
                                  URL url = null;
                                  String name = null;
                                  if(args.length == 2)
                                  {
                                     url = new URL(args[0]);
                                     name = args[1];
                                  }
                                  else
                                  {
                                     url = new
URL("http://wajra.india.sun.com:85/soap/rpcrouter");
                                     name = args[0];
                                  }

                                  // Build the call.
                                  SOAPHTTPConnection shc = new
SOAPHTTPConnection ();
                                  shc.setMaintainSession (true);
                                  Call call = new Call();
                                  call.setTargetObjectURI("urn:Hello");
                                  call.setMethodName("sayHelloTo");

call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
                                  call.setSOAPTransport (shc);
                                  Vector params = new Vector();
                                  params.addElement(new
Parameter("name", String.class, name, null));
                                  call.setParams(params);

                                  // Invoke the call.
                                  Response resp = null;
                                  try
                                  {
                                     resp = call.invoke(url, "");
                                  }
                                  catch( SOAPException e )
                                  {
                                     System.err.println("Caught
SOAPException (" + e.getFaultCode() + "): " + e.getMessage());
                                     System.exit(-1);
                                  }

                                  // Check the response.
                                  if( !resp.generatedFault() )
                                  {
                                     Parameter ret =
resp.getReturnValue();
                                     Object value = ret.getValue();
                                     System.out.println(value);
                                  }
                                  else
                                  {
                                     Fault fault = resp.getFault();
                                     System.err.println("Generated
fault: ");
                                     System.out.println ("  Fault Code
= " + fault.getFaultCode());
                                     System.out.println ("  Fault String
= " + fault.getFaultString());
                                  }
                                  resp = null;
                                  Call Nextcall = new Call();

Nextcall.setTargetObjectURI("urn:Hello");
                                  Nextcall.setMethodName("sayHelloTo");

Nextcall.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
                                  Nextcall.setSOAPTransport (shc);
                                  Vector nextparams = new Vector();
                                  nextparams.addElement(new
Parameter("name", String.class, name, null));
                                  Nextcall.setParams(nextparams);

                                  try
                                  {
                                     resp = Nextcall.invoke(url, "");
                                  }
                                  catch( SOAPException e )
                                  {
                                     System.err.println("Caught
SOAPException (" + e.getFaultCode() + "): "+ e.getMessage());
                                     System.exit(-1);
                                  }

                                  // Check the response.
                                  if( !resp.generatedFault() )
                                  {
                                     Parameter ret =
resp.getReturnValue();
                                     Object value = ret.getValue();
                                     System.out.println(value);
                                  }
                                  else
                                  {
                                     Fault fault = resp.getFault();
                                     System.err.println("Generated
fault: ");
                                     System.out.println ("  Fault Code
= " + fault.getFaultCode());
                                     System.out.println ("  Fault String
= " + fault.getFaultString());
                                  }

                               }
                               catch(Exception e)
                               {
                                  e.printStackTrace();
                               }
                            }
                         }


Thanks and Regards
Rajashekar




RE: Help:WSDL To SOAP Message

Posted by Thomas Thornbury <th...@optonline.net>.
XMLSpy will gen a SOAP request from a WSDL file.

-----Original Message-----
From: root@alumnux.com [mailto:root@alumnux.com] On Behalf Of Kallol
Banerjee
Sent: Tuesday, January 29, 2002 4:49 AM
To: soap-user@xml.apache.org
Subject: Help:WSDL To SOAP Message


Hi All,

I am using Axis now a days. I was checking out the WSDL functionalily
added with the tool kit.

Please advice me with the following :

1. Can I use the tool to generate a SOAP message from a WSDL file with
the existing tool instead of <wsdl2java >

2. Can I some how use the WSDL file so that client can orginate some
SOAP - RPC request from the service desciption given in WSDL file.

Please do advice.
Thanks and regards,
kallol



RE: Help:WSDL To SOAP Message

Posted by Thomas Thornbury <th...@optonline.net>.
XMLSpy will gen a SOAP request from a WSDL file.

-----Original Message-----
From: root@alumnux.com [mailto:root@alumnux.com] On Behalf Of Kallol
Banerjee
Sent: Tuesday, January 29, 2002 4:49 AM
To: soap-user@xml.apache.org
Subject: Help:WSDL To SOAP Message


Hi All,

I am using Axis now a days. I was checking out the WSDL functionalily
added with the tool kit.

Please advice me with the following :

1. Can I use the tool to generate a SOAP message from a WSDL file with
the existing tool instead of <wsdl2java >

2. Can I some how use the WSDL file so that client can orginate some
SOAP - RPC request from the service desciption given in WSDL file.

Please do advice.
Thanks and regards,
kallol



Help:WSDL To SOAP Message

Posted by Kallol Banerjee <ka...@alumnux.com>.
Hi All,

I am using Axis now a days. I was checking out the WSDL functionalily added
with the tool kit.

Please advice me with the following :

1. Can I use the tool to generate a SOAP message from a WSDL file with the
existing tool instead of <wsdl2java >

2. Can I some how use the WSDL file so that client can orginate some SOAP -
RPC request from the service desciption given in WSDL file.

Please do advice.
Thanks and regards,
kallol


Help:WSDL To SOAP Message

Posted by Kallol Banerjee <ka...@alumnux.com>.
Hi All,

I am using Axis now a days. I was checking out the WSDL functionalily added
with the tool kit.

Please advice me with the following :

1. Can I use the tool to generate a SOAP message from a WSDL file with the
existing tool instead of <wsdl2java >

2. Can I some how use the WSDL file so that client can orginate some SOAP -
RPC request from the service desciption given in WSDL file.

Please do advice.
Thanks and regards,
kallol