File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Session ID is not valid.  How to pass sessionid as part of header of soap message in jaxws client. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "Session ID is not valid.  How to pass sessionid as part of header of soap message in jaxws client." Watch "Session ID is not valid.  How to pass sessionid as part of header of soap message in jaxws client." New topic
Author

Session ID is not valid. How to pass sessionid as part of header of soap message in jaxws client.

sridhar vempali
Greenhorn

Joined: Sep 10, 2012
Posts: 1
I am getting "Session ID is not valid." error while invoking "logout" webserivce call.

here is the "logout" XML request ( captured from soapui):-
------------------------------------------------------------------
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsh="http://www.informatica.com/wsh">
<soapenv:Header>
<wsh:Context>
<SessionId>?</SessionId>
</wsh:Context>
</soapenv:Header>
<soapenv:Body>
<wsh:Logout/>
</soapenv:Body>
</soapenv:Envelope>

After seeing this request XML message ( from Soap UI), I realized that I should pass SessionId in the header. I could not do this. please let me how to do this.

I generated java classes using WSDL in myeclipse ( jaxws).

Here is my test client code for reference :-
-------------------------------------------------
MetadataInterface inter = null;
LoginRequest req = null;
String sessionId = null;

try
{
MetadataService service = new MetadataService();

inter = service.getMetadata();

req = new LoginRequest();
req.setRepositoryDomainName("DevDomain_02");
req.setRepositoryName("ETLRepDev_02");
req.setUserName("Administrator");
req.setPassword("et1admin");

sessionId = inter.login(req);

System.out.println("Session id=" + sessionId);

/*
SessionHeader sh = new SessionHeader();
sh.setSessionId(sessionId);

ObjectFactory factory = new ObjectFactory();
JAXBElement element = factory.createContext(sh);
*/

DIServerInfoArray diServersInfo = inter.getAllDIServers(new VoidRequest()); }
catch(Exception e)
{
e.printStackTrace();
}
finally
{
if( inter != null)
inter.logout(new VoidRequest()); }


please help me on how to pass session id in the context of header. login call is successful. After that , logout/getAllDIServers calls are throwing "Session ID is not valid" error.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Session ID is not valid. How to pass sessionid as part of header of soap message in jaxws client.
 
Similar Threads
AXIS2 : Inclusion of Headers into SOAP fault message and changing the namespaces
Apache CXF and Properties file
Invoke .NET Web Service using Java/Axis passing SoapHeader
sending pdf or any attachment from a java webservice to java client using JAX-WS and SAAJ
webservice calling from url