• eneilsen
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
I'm trying to set the sessionId without using the SessionHeader object. This is the error that I'm getting:

Code:
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
 at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.getSOAPFaultException(SOAPFaultHelperJAXWS.java:56)
 at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.throwFaultException(SOAP11BindingJAXWS.java:111)
 at org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage(CommonSOAPBinding.java:460)
 at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:333)
 at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:185)
 at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:163)
 at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:149)
 at $Proxy22.query(Unknown Source)
 at salesforce.JbossWSConnection.querySample(JbossWSConnection.java:130)
 at salesforce.JbossWSConnection.main(JbossWSConnection.java:74)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

 
Does anyone know what the Parameter Name is used to include the sesssionID?  Is it SessionID, sessionID, SessionHeader?
Using Axis I'll I have to do is:
SessionCode:
SessionHeader sessionHeader = new SessionHeader();
sessionHeader.setSessionId(sessionID);
String sforceURI = new SforceServiceLocator().getServiceName().getNamespaceURI();
service.setHeader(sforceURI, "SessionHeader", sessionHeader); 

I'm trying to do the same thing with JBossWS; however, I'm running into problems.
I've tried:
URL urlToWSDL = JbossWSConnection.class.getResource("/partner-wsdl.xml");
QName q = new QName("urn:partner.soap.sforce.com", "SforceService");
SforceService service = new SforceService(urlToWSDL, q);
Soap soapBinding = service.getSoap();
StubExt stub = (StubExt)soapBinding;
LoginResult lr = soapBinding.login("username", "password");
SessionHeader session = new SessionHeader();
session.setSessionId(lr.getSessionId())
QName headerQ = new QName(service.getServiceName().getNamespaceURI(), "SessionHeader");
stub.addUnboundHeader(headerQ, Constants.TYPE_LITERAL_ANYTYPE, SessionHeader.class, ParameterMode.IN
);
stub.setUnboundHeaderValue(headerQ, session);
But I get the following error:
Caused by: org.jboss.ws.WSException: Cannot obtain serializer factory for: [xmlType={http://www.w3.org/2001/XMLSchema}anyType,javaType=class com.sforce.soap.partner.SessionHeader]
at org.jboss.ws.core.soap.ObjectContent.getSerializerFactory(ObjectContent.java:189)
at org.jboss.ws.core.soap.ObjectContent.marshallObjectContents(ObjectContent.java:139)
at org.jboss.ws.core.soap.ObjectContent.transitionTo(ObjectContent.java:65)
at org.jboss.ws.core.soap.SOAPContentElement.transitionTo(SOAPContentElement.java:129)
at org.jboss.ws.core.soap.SOAPContentElement.writeElement(SOAPContentElement.java:536)
at org.jboss.ws.core.soap.SOAPHeaderElementImpl.writeElement(SOAPHeaderElementImpl.java:132)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElementImpl.java:825)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.java:810)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElementImpl.java:825)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.java:810)
at org.jboss.ws.core.soap.SOAPElementWriter.writeElementInternal(SOAPElementWriter.java:149)
at org.jboss.ws.core.soap.SOAPElementWriter.writeElement(SOAPElementWriter.java:130)
at org.jboss.ws.core.soap.SOAPMessageImpl.writeTo(SOAPMessageImpl.java:288)
at org.jboss.ws.core.soap.SOAPMessageMarshaller.write(SOAPMessageMarshaller.java:76)
at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:164)





I've made a post on JBossWS forums: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=112913
I'm trying to set the sessionId without using the SessionHeader object. This is the error that I'm getting:

Code:
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
 at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.getSOAPFaultException(SOAPFaultHelperJAXWS.java:56)
 at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.throwFaultException(SOAP11BindingJAXWS.java:111)
 at org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage(CommonSOAPBinding.java:460)
 at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:333)
 at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:185)
 at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:163)
 at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:149)
 at $Proxy22.query(Unknown Source)
 at salesforce.JbossWSConnection.querySample(JbossWSConnection.java:130)
 at salesforce.JbossWSConnection.main(JbossWSConnection.java:74)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

 
Does anyone know what the Parameter Name is used to include the sesssionID?  Is it SessionID, sessionID, SessionHeader?
Using Axis I'll I have to do is:
SessionCode:
SessionHeader sessionHeader = new SessionHeader();
sessionHeader.setSessionId(sessionID);
String sforceURI = new SforceServiceLocator().getServiceName().getNamespaceURI();
service.setHeader(sforceURI, "SessionHeader", sessionHeader); 

I'm trying to do the same thing with JBossWS; however, I'm running into problems.
I've tried:
URL urlToWSDL = JbossWSConnection.class.getResource("/partner-wsdl.xml");
QName q = new QName("urn:partner.soap.sforce.com", "SforceService");
SforceService service = new SforceService(urlToWSDL, q);
Soap soapBinding = service.getSoap();
StubExt stub = (StubExt)soapBinding;
LoginResult lr = soapBinding.login("username", "password");
SessionHeader session = new SessionHeader();
session.setSessionId(lr.getSessionId())
QName headerQ = new QName(service.getServiceName().getNamespaceURI(), "SessionHeader");
stub.addUnboundHeader(headerQ, Constants.TYPE_LITERAL_ANYTYPE, SessionHeader.class, ParameterMode.IN
);
stub.setUnboundHeaderValue(headerQ, session);
But I get the following error:
Caused by: org.jboss.ws.WSException: Cannot obtain serializer factory for: [xmlType={http://www.w3.org/2001/XMLSchema}anyType,javaType=class com.sforce.soap.partner.SessionHeader]
at org.jboss.ws.core.soap.ObjectContent.getSerializerFactory(ObjectContent.java:189)
at org.jboss.ws.core.soap.ObjectContent.marshallObjectContents(ObjectContent.java:139)
at org.jboss.ws.core.soap.ObjectContent.transitionTo(ObjectContent.java:65)
at org.jboss.ws.core.soap.SOAPContentElement.transitionTo(SOAPContentElement.java:129)
at org.jboss.ws.core.soap.SOAPContentElement.writeElement(SOAPContentElement.java:536)
at org.jboss.ws.core.soap.SOAPHeaderElementImpl.writeElement(SOAPHeaderElementImpl.java:132)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElementImpl.java:825)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.java:810)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElementImpl.java:825)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.java:810)
at org.jboss.ws.core.soap.SOAPElementWriter.writeElementInternal(SOAPElementWriter.java:149)
at org.jboss.ws.core.soap.SOAPElementWriter.writeElement(SOAPElementWriter.java:130)
at org.jboss.ws.core.soap.SOAPMessageImpl.writeTo(SOAPMessageImpl.java:288)
at org.jboss.ws.core.soap.SOAPMessageMarshaller.write(SOAPMessageMarshaller.java:76)
at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:164)





I've made a post on JBossWS forums: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=112913