I think i'm getting a little closer, after reading the JAX-RPC user guild I think I
need to set the: Unbound SOAP Headers on the client proxy, see
http://jbws.dyndns.org/mediawiki/index.php?title=JAX-RPC_User_Guide#Unbou...
I've tried this but it didn't seem to work
| 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);
This is the error that I get:
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'm guessing the problem has to do with
stub.addUnboundHeader(headerQ, Constants.TYPE_LITERAL_ANYTYPE, SessionHeader.class,
ParameterMode.IN); any Idea on which QName xmlType I should pick? I'm using the
org.jboss.ws.Constants Interface.
I've also tried:
| QName headerQ = new QName(service.getServiceName().getNamespaceURI(),
"SessionHeader");
| SessionHeader.class, ParameterMode.IN);
| stub.addUnboundHeader(headerQ, Constants.TYPE_LITERAL_STRING, String.class,
ParameterMode.IN);
| stub.setUnboundHeaderValue(headerQ, lr.getSessionId());
|
but then I get the infamous:
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:165)
at salesforce.JbossWSConnection.main(JbossWSConnection.java:66)
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)
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062129#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...