1 Reply Latest reply on Jul 9, 2007 1:05 PM by thomas.diesler

    using a derived class from javax.xml.ws.Service I need to ca

    eric2

      Trying to integrate into SalesForce using JBossws1.2 SP1 instead of Axis.

      I've generated the java stubs and I can connect just fine. One I login I'm given a new SeverURL and a sessionID. I need to change the location that I connect to and I need to attach the SessionID to the soap Bindings for every subsequent request.

      QName q = new QName("urn:partner.soap.sforce.com", "SforceService");
      SforceService service = new SforceService(urlToWSDL, q);
      LoginResult lr = service.getSoap().login("username", "password");
      System.out.println("lr.getServerUrl() = " + lr.getServerUrl());
      System.out.println("lr.getSessionId() = " + lr.getSessionId());



      SforceService extends javax.xml.ws.Service and was generated by wsconsume from the sales-force partner wsdl.

      I need to set the new server url to the lr.getServerUrl and I need to include the lr.getSessionId as a SOAP header.

      I can get this to work using Axis but I want to use JBossWS.
      --------USING AXIS ---------
      SforceService service extends org.apache.axis.client.Stub. The axis org.apache.axis.client.Stub provides _setProperty and setHeader
      Example:
      service._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY, serverURL);

      and
      SessionHeader sessionHeader = new SessionHeader();
      sessionHeader.setSessionId(sessionID);
      // Add the header to the binding stub.
      String sforceURI = new SforceServiceLocator().getServiceName().getNamespaceURI();
      service.setHeader(sforceURI, "SessionHeader", sessionHeader);