• Streepie
  • NEWBIE
  • 50 Points
  • Member since 2009

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies

 

I want to set the sessionId value in the header of the Upsert operation

with the value i just got from the Login operation.

 

I am new in java, i don't know how to get the value to set it again in the header  

 

 

 

this is the my generated java code:

 

/**
 * SalesForceAgent_EnterpriceService.java
 *
 * This file was generated by LANSA Integrator SOAP Agent Wizard
 */
package com.marktselect.service.soap ;

public class SalesForceAgent_EnterpriceService implements com.lansa.jsm.service.SOAPAgentHandler
{

    /*
        Operation - login
    */

    public final void setOperation_LOGIN ()
    {
    }

    /*
        Operation Request - login
    */

    public final void prepareRequest_LOGIN ( com.lansa.jsm.service.SOAPAgentRequest request ) throws Exception
    {
        request.prepareParameter ( "USERNAME", java.lang.String.class, false, false ) ;
        request.prepareParameter ( "PASSWORD", java.lang.String.class, false, false ) ;
    }

    /*
        Operation Parameter - login
    */

    public final void setParameter_LOGIN_USERNAME ( com.lansa.jsm.service.SOAPAgentParameter parameter, com.lansa.jsm.service.SOAPAgentBind bind ) throws Exception
    {
        parameter.setEntity ( bind.getFieldValue ( "MSLOGUSR" ), null, null ) ;
    }

    /*
        Operation Parameter - login
    */

    public final void setParameter_LOGIN_PASSWORD ( com.lansa.jsm.service.SOAPAgentParameter parameter, com.lansa.jsm.service.SOAPAgentBind bind ) throws Exception
    {
        parameter.setEntity ( bind.getFieldValue ( "MSLOGPWD" ), null, null ) ;
    }

    /*
        Operation Response - login
    */

    public final void prepareResponse_LOGIN ( com.lansa.jsm.service.SOAPAgentResponse response ) throws Exception
    {
        response.prepareFragment ( new String[] { "LOGIN" }, com.sforce.soap.enterprise.LoginResult.class, false, true, null ) ;
        response.prepareFragment ( new String[] { "LOGIN", "USERINFO" }, com.sforce.soap.enterprise.GetUserInfoResult.class, false, true, "getUserInfo" ) ;
    }

    /*
        Operation Fragment - login
    */

    public final void getFragment_LOGIN_LOGIN ( com.lansa.jsm.service.SOAPAgentResponseFragment fragment, com.lansa.jsm.service.SOAPAgentBind bind ) throws Exception
    {
        bind.setFieldValue ( "URLSERVER", fragment.getEntity ( "metadataServerUrl", null ) ) ;
        bind.setFieldValue ( "PWEXPIRED", fragment.getEntity ( "passwordExpired", null ) ) ;
        bind.setFieldValue ( "SANDBOX", fragment.getEntity ( "sandbox", null ) ) ;
        bind.setFieldValue ( "SERVERURL", fragment.getEntity ( "serverUrl", null ) ) ;
        bind.setFieldValue ( "SESSIONID", fragment.getEntity ( "sessionId", null ) ) ;
        bind.setFieldValue ( "USERID", fragment.getEntity ( "userId", null ) ) ;
    }

    /*
        Operation Fragment - login
    */

    public final void getFragment_LOGIN_USERINFO ( com.lansa.jsm.service.SOAPAgentResponseFragment fragment, com.lansa.jsm.service.SOAPAgentBind bind ) throws Exception
    {
        bind.setFieldValue ( "ACCMODE", fragment.getEntity ( "accessibilityMode", null ) ) ;
        bind.setFieldValue ( "CURSYMBOL", fragment.getEntity ( "currencySymbol", null ) ) ;
        bind.setFieldValue ( "ORGISOCOD", fragment.getEntity ( "orgDefaultCurrencyIsoCode", null ) ) ;
        bind.setFieldValue ( "PERSACC", fragment.getEntity ( "orgHasPersonAccounts", null ) ) ;
        bind.setFieldValue ( "ORGID", fragment.getEntity ( "organizationId", null ) ) ;
        bind.setFieldValue ( "ORGMLTCUR", fragment.getEntity ( "organizationMultiCurrency", null ) ) ;
        bind.setFieldValue ( "MSBEDRNM", fragment.getEntity ( "organizationName", null ) ) ;
        bind.setFieldValue ( "MSPROFILE", fragment.getEntity ( "profileId", null ) ) ;
        bind.setFieldValue ( "ROLEID", fragment.getEntity ( "roleId", null ) ) ;
        bind.setFieldValue ( "DEFCURCOD", fragment.getEntity ( "userDefaultCurrencyIsoCode", null ) ) ;
        bind.setFieldValue ( "MSEMAIL", fragment.getEntity ( "userEmail", null ) ) ;
        bind.setFieldValue ( "MSFULLNM", fragment.getEntity ( "userFullName", null ) ) ;
        bind.setFieldValue ( "MSUSRID", fragment.getEntity ( "userId", null ) ) ;
        bind.setFieldValue ( "USERLANG", fragment.getEntity ( "userLanguage", null ) ) ;
        bind.setFieldValue ( "USERLOCAL", fragment.getEntity ( "userLocale", null ) ) ;
        bind.setFieldValue ( "USRNAME", fragment.getEntity ( "userName", null ) ) ;
        bind.setFieldValue ( "TIMEZONE", fragment.getEntity ( "userTimeZone", null ) ) ;
        bind.setFieldValue ( "MSUSRTYPE", fragment.getEntity ( "userType", null ) ) ;
        bind.setFieldValue ( "UISKIN", fragment.getEntity ( "userUiSkin", null ) ) ;
    }

    /*
        Operation Return - login
    */

    public final void getReturnParameter_LOGIN ( com.lansa.jsm.service.SOAPAgentResponse response, com.lansa.jsm.service.SOAPAgentBind bind ) throws Exception
    {
    }

    /*
        Operation Call - login
    */

    public final com.lansa.jsm.service.SOAPAgentResponse callOperation_LOGIN ( com.lansa.jsm.service.SOAPAgentRequest request, String user, String password, String url ) throws Exception
    {
        com.sforce.soap.enterprise.SforceServiceLocator locator = new com.sforce.soap.enterprise.SforceServiceLocator () ;

        String endPoint = locator.getSoapAddress () ;

        if ( url != null )
        {
            endPoint = url ;
        }

        com.sforce.soap.enterprise.SoapBindingStub stub = (com.sforce.soap.enterprise.SoapBindingStub)locator.getSoap ( new java.net.URL ( endPoint ) ) ;

        if ( user != null && password != null )
        {
            stub.setUsername ( user ) ;

            stub.setPassword ( password ) ;
        }

/*

    Add SOAP header

*/


org.apache.axis.message.SOAPHeaderElement elementHead = new org.apache.axis.message.SOAPHeaderElement ("", "SessionHeader");
 

javax.xml.soap.SOAPElement elementsessionId = elementHead.addChildElement ( "sessionId" ) ;

elementsessionId.addTextNode ( "HOW DO I GET THE SESSIONID IN HERE?" );

stub.setHeader ( elementHead ) ;

 

/*

   End SOAP header
*/

        request.traceStub ( stub ) ;

        return new com.lansa.jsm.service.SOAPAgentResponse ( stub.login( request.getParameterValueString ( "USERNAME" ), request.getParameterValueString ( "PASSWORD" ) ) ) ;
    }

    /*
        Operation - upsert
    */

    public final void setOperation_UPSERT ()
    {
    }

    /*
        Operation Request - upsert
    */

    public final void prepareRequest_UPSERT ( com.lansa.jsm.service.SOAPAgentRequest request ) throws Exception
    {
        request.prepareParameter ( "EXTERNALIDFIELDNAME", java.lang.String.class, false, false ) ;
        request.prepareParameter ( "SOBJECTS", com.sforce.soap.enterprise.sobject.SObject.class, true, true ) ;
        request.prepareFragment ( "SOBJECTS", new String[] { "UPSERTOBJ" }, com.sforce.soap.enterprise.sobject.SObject.class, true, true, null ) ;
        request.prepareList ( "SOBJECTS", new String[] { "UPSERTOBJ", "OBJNAME" }, java.lang.String.class, true, false, "setFieldsToNull" ) ;
    }

    /*
        Operation Parameter - upsert
    */

    public final void setParameter_UPSERT_EXTERNALIDFIELDNAME ( com.lansa.jsm.service.SOAPAgentParameter parameter,

 

    etc... 

 

 

 

 

this is the my generated message i sent:

 

 

<?xml version="1.0" encoding="UTF-8" ?>
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <soapenv:Header>
- <SessionHeader soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
  <sessionId>HOW DO I GET THE SESSIONID IN HERE?</sessionId>
  </SessionHeader>
  </soapenv:Header>
- <soapenv:Body>
- <upsert xmlns="urn:enterprise.soap.sforce.com">
  <externalIDFieldName>mskey__c</externalIDFieldName>
- <sObjects>
  <ns1:fieldsToNull xmlns:ns1="urn:sobject.enterprise.soap.sforce.com">34</ns1:fieldsToNull>
  <ns2:Id xmlns:ns2="urn:sobject.enterprise.soap.sforce.com">11111</ns2:Id>
  </sObjects>
  </upsert>
  </soapenv:Body>
  </soapenv:Envelope>

Can I get a mail from an apex code that calls a webservice when the request fails because the servcie is not Live or just fails.

 

or

 

just when there is no response from the external server 

 

 

I don't know how to debug the response (system.debug does nothing ?)

 

What does salesforce server do when a call to a webservice doesn't get a response and how can i tackle it?

Hi,

 

 

I have to update a Custom field in Account before update of account 

 

So I have a trigger on Accounts before update

 

That trigger is calling a apex class which executes a webservice request to a external webservice

 

I am getting a value back in the respone...

 

BUT when i try to update the account in the Apex class i am getting a error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

 

 

 

THIS IS MY TRIGGER 

 

trigger updateRelatienrInAccountIfKlant on Account (after insert, after update) {

    System.debug('Trigger on account');
     
  
    
    string uid=UserInfo.getUserId();
    User usr = [SELECT Alias FROM User WHERE Id = :uid];
    
    
    // Find accounts to update  
    for(Account a: Trigger.new){
      
       
          
            integer mskey = integer.valueof(a.MarktSelect_Sleutel__c);
            soapmessage_naar_marktselect.salesforce(a.Id, usr.Alias, uid, mskey);
    }
}

 

 

 

THIS IS MY APEX CLASS

 

 

public class soapmessage_naar_marktselect {

  //Future annotation to mark the method as async.
  // methods may call this class =callout=true
  @Future(callout=true)

   public static void salesforce(String id, String uid, String upw, Integer mskey ) {

   System.debug('Calling ccc.marktselect.nl/SFservice');


   //construct an HTTP request
   HttpRequest req = new HttpRequest();
   req.setEndpoint('http://www.abc.nl/cgi-bin/jsmdirect?SFservice');
   req.setMethod('POST');
   req.setHeader('Content-Type', 'text/xml; charset=utf-8');

   // Create the soap message envelope 
   String soapMsg = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soapserver.jsm.marktselect.com">'+
                       '<soapenv:Header/>'+
                           '<soapenv:Body>'+
                             '<soap:NewAccount>'+
                             '<soap:UserId>'+uid+'</soap:UserId>'+
                             '<soap:UserPw>'+upw+'</soap:UserPw>'+
                             '<soap:Mskey>'+mskey+'</soap:Mskey>'+
                          '</soap:NewAccount>'+
                       '</soapenv:Body>'+
                    '</soapenv:Envelope>';
                
   // set the soapbody to the message envelope                 
   req.setBody(soapMsg);




   //send the request
   Http http = new Http();
   HttpResponse res = http.send(req);
     
   integer rlcode = 0;
       
   //check the response
   if (res.getStatusCode() == 200) {
         XMLDom responseXML = new XMLDom(res.getBody());
         rlcode = integer.valueof(responseXML.getElementByTagName('relatiecode').nodeValue);
         
         if (rlcode != 0){
             //update account
             Account acc = new Account(Id=id);
             acc.Relatienr__c = rlcode;
             update acc;
             
         } 

    } else {
          System.debug('Callout failed: ' + res);
    }
     
  }
}

 

The SELECT line fails....?

 

what am i doing wrong?

 

the error says: Invalid bind expression type of SOBJECT:Account for column of type String op regel 13 kolom 75 

 

 

trigger getRelatiecode on Opportunity (after insert) {

  System.debug('Making future call to sfservice');
  for (Opportunity opp : Trigger.New) {
    //Call future method to update account
    //with data from external server.
    //This is a async calls, it returns right away, after
    //enqueuing the request.

    string UID=UserInfo.getUserId();
    string UPW=UserInfo.getFirstName();
   
    string MK = [SELECT MarktSelect_Sleutel__c FROM Account WHERE Name = :opp.Account];
   
    integer MKR = integer.valueof(MK.MarktSelect_Sleutel__c);
   
    //SFservice.sFservice(opp.id, UID, UPW, MKR);
  }

}

I have some apex-class code in a developers enviroment, works just fine!

 

I copy the code in a sandbox and de compilation fails on the line:

 

XMLDom responseXML = new XMLDom(res.getBody()); 

 

 

why?

 

public class SFService {

  //Future annotation to mark the method as async.
  // methods may call this class =callout=true
  @Future(callout=true)

   public static void SFservice(String id, String uid, String upw, Integer mskey ) {

   //construct an HTTP request
   HttpRequest req = new HttpRequest();
   req.setEndpoint('http://www.url.com/cgi-bin/jsmdirect?SFservice');
   req.setMethod('POST');
   req.setHeader('Content-Type', 'text/xml; charset=utf-8');

   // Create the soap message envelope 
   String soapMsg = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soapserver.jsm.marktselect.com">'+
                       '<soapenv:Header/>'+
                           '<soapenv:Body>'+
                             '<soap:NewAccount>'+
                             '<soap:UserId>'+uid+'</soap:UserId>'+
                             '<soap:UserPw>'+upw+'</soap:UserPw>'+
                             '<soap:Mskey>'+mskey+'</soap:Mskey>'+
                          '</soap:NewAccount>'+
                       '</soapenv:Body>'+
                    '</soapenv:Envelope>';
                
   // set the soapbody to the message envelope                 
   req.setBody(soapMsg);




   //send the request
   Http http = new Http();
   HttpResponse res = http.send(req);
       
   //check the response
   if (res.getStatusCode() == 200) {
         XMLDom responseXML = new XMLDom(res.getBody());
         string rlcode = responseXML.getElementByTagName('relatiecode').nodeValue;
       

          //update account
          Account acc = new Account(Id=id);
          acc.AccountNumber = rlcode; 
          acc.Description = res.getStatus() ;
          update acc;
    } else {
          System.debug('Callout failed: ' + res);
          Account acc = new Account(Id=id);
          acc.Description = res.getStatus() ;
          update acc;

    } 
  }
}

Hi,

 

 

I have to update a Custom field in Account before update of account 

 

So I have a trigger on Accounts before update

 

That trigger is calling a apex class which executes a webservice request to a external webservice

 

I am getting a value back in the respone...

 

BUT when i try to update the account in the Apex class i am getting a error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

 

 

 

THIS IS MY TRIGGER 

 

trigger updateRelatienrInAccountIfKlant on Account (after insert, after update) {

    System.debug('Trigger on account');
     
  
    
    string uid=UserInfo.getUserId();
    User usr = [SELECT Alias FROM User WHERE Id = :uid];
    
    
    // Find accounts to update  
    for(Account a: Trigger.new){
      
       
          
            integer mskey = integer.valueof(a.MarktSelect_Sleutel__c);
            soapmessage_naar_marktselect.salesforce(a.Id, usr.Alias, uid, mskey);
    }
}

 

 

 

THIS IS MY APEX CLASS

 

 

public class soapmessage_naar_marktselect {

  //Future annotation to mark the method as async.
  // methods may call this class =callout=true
  @Future(callout=true)

   public static void salesforce(String id, String uid, String upw, Integer mskey ) {

   System.debug('Calling ccc.marktselect.nl/SFservice');


   //construct an HTTP request
   HttpRequest req = new HttpRequest();
   req.setEndpoint('http://www.abc.nl/cgi-bin/jsmdirect?SFservice');
   req.setMethod('POST');
   req.setHeader('Content-Type', 'text/xml; charset=utf-8');

   // Create the soap message envelope 
   String soapMsg = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soapserver.jsm.marktselect.com">'+
                       '<soapenv:Header/>'+
                           '<soapenv:Body>'+
                             '<soap:NewAccount>'+
                             '<soap:UserId>'+uid+'</soap:UserId>'+
                             '<soap:UserPw>'+upw+'</soap:UserPw>'+
                             '<soap:Mskey>'+mskey+'</soap:Mskey>'+
                          '</soap:NewAccount>'+
                       '</soapenv:Body>'+
                    '</soapenv:Envelope>';
                
   // set the soapbody to the message envelope                 
   req.setBody(soapMsg);




   //send the request
   Http http = new Http();
   HttpResponse res = http.send(req);
     
   integer rlcode = 0;
       
   //check the response
   if (res.getStatusCode() == 200) {
         XMLDom responseXML = new XMLDom(res.getBody());
         rlcode = integer.valueof(responseXML.getElementByTagName('relatiecode').nodeValue);
         
         if (rlcode != 0){
             //update account
             Account acc = new Account(Id=id);
             acc.Relatienr__c = rlcode;
             update acc;
             
         } 

    } else {
          System.debug('Callout failed: ' + res);
    }
     
  }
}

 

 

I want to set the sessionId value in the header of the Upsert operation

with the value i just got from the Login operation.

 

I am new in java, i don't know how to get the value to set it again in the header  

 

 

 

this is the my generated java code:

 

/**
 * SalesForceAgent_EnterpriceService.java
 *
 * This file was generated by LANSA Integrator SOAP Agent Wizard
 */
package com.marktselect.service.soap ;

public class SalesForceAgent_EnterpriceService implements com.lansa.jsm.service.SOAPAgentHandler
{

    /*
        Operation - login
    */

    public final void setOperation_LOGIN ()
    {
    }

    /*
        Operation Request - login
    */

    public final void prepareRequest_LOGIN ( com.lansa.jsm.service.SOAPAgentRequest request ) throws Exception
    {
        request.prepareParameter ( "USERNAME", java.lang.String.class, false, false ) ;
        request.prepareParameter ( "PASSWORD", java.lang.String.class, false, false ) ;
    }

    /*
        Operation Parameter - login
    */

    public final void setParameter_LOGIN_USERNAME ( com.lansa.jsm.service.SOAPAgentParameter parameter, com.lansa.jsm.service.SOAPAgentBind bind ) throws Exception
    {
        parameter.setEntity ( bind.getFieldValue ( "MSLOGUSR" ), null, null ) ;
    }

    /*
        Operation Parameter - login
    */

    public final void setParameter_LOGIN_PASSWORD ( com.lansa.jsm.service.SOAPAgentParameter parameter, com.lansa.jsm.service.SOAPAgentBind bind ) throws Exception
    {
        parameter.setEntity ( bind.getFieldValue ( "MSLOGPWD" ), null, null ) ;
    }

    /*
        Operation Response - login
    */

    public final void prepareResponse_LOGIN ( com.lansa.jsm.service.SOAPAgentResponse response ) throws Exception
    {
        response.prepareFragment ( new String[] { "LOGIN" }, com.sforce.soap.enterprise.LoginResult.class, false, true, null ) ;
        response.prepareFragment ( new String[] { "LOGIN", "USERINFO" }, com.sforce.soap.enterprise.GetUserInfoResult.class, false, true, "getUserInfo" ) ;
    }

    /*
        Operation Fragment - login
    */

    public final void getFragment_LOGIN_LOGIN ( com.lansa.jsm.service.SOAPAgentResponseFragment fragment, com.lansa.jsm.service.SOAPAgentBind bind ) throws Exception
    {
        bind.setFieldValue ( "URLSERVER", fragment.getEntity ( "metadataServerUrl", null ) ) ;
        bind.setFieldValue ( "PWEXPIRED", fragment.getEntity ( "passwordExpired", null ) ) ;
        bind.setFieldValue ( "SANDBOX", fragment.getEntity ( "sandbox", null ) ) ;
        bind.setFieldValue ( "SERVERURL", fragment.getEntity ( "serverUrl", null ) ) ;
        bind.setFieldValue ( "SESSIONID", fragment.getEntity ( "sessionId", null ) ) ;
        bind.setFieldValue ( "USERID", fragment.getEntity ( "userId", null ) ) ;
    }

    /*
        Operation Fragment - login
    */

    public final void getFragment_LOGIN_USERINFO ( com.lansa.jsm.service.SOAPAgentResponseFragment fragment, com.lansa.jsm.service.SOAPAgentBind bind ) throws Exception
    {
        bind.setFieldValue ( "ACCMODE", fragment.getEntity ( "accessibilityMode", null ) ) ;
        bind.setFieldValue ( "CURSYMBOL", fragment.getEntity ( "currencySymbol", null ) ) ;
        bind.setFieldValue ( "ORGISOCOD", fragment.getEntity ( "orgDefaultCurrencyIsoCode", null ) ) ;
        bind.setFieldValue ( "PERSACC", fragment.getEntity ( "orgHasPersonAccounts", null ) ) ;
        bind.setFieldValue ( "ORGID", fragment.getEntity ( "organizationId", null ) ) ;
        bind.setFieldValue ( "ORGMLTCUR", fragment.getEntity ( "organizationMultiCurrency", null ) ) ;
        bind.setFieldValue ( "MSBEDRNM", fragment.getEntity ( "organizationName", null ) ) ;
        bind.setFieldValue ( "MSPROFILE", fragment.getEntity ( "profileId", null ) ) ;
        bind.setFieldValue ( "ROLEID", fragment.getEntity ( "roleId", null ) ) ;
        bind.setFieldValue ( "DEFCURCOD", fragment.getEntity ( "userDefaultCurrencyIsoCode", null ) ) ;
        bind.setFieldValue ( "MSEMAIL", fragment.getEntity ( "userEmail", null ) ) ;
        bind.setFieldValue ( "MSFULLNM", fragment.getEntity ( "userFullName", null ) ) ;
        bind.setFieldValue ( "MSUSRID", fragment.getEntity ( "userId", null ) ) ;
        bind.setFieldValue ( "USERLANG", fragment.getEntity ( "userLanguage", null ) ) ;
        bind.setFieldValue ( "USERLOCAL", fragment.getEntity ( "userLocale", null ) ) ;
        bind.setFieldValue ( "USRNAME", fragment.getEntity ( "userName", null ) ) ;
        bind.setFieldValue ( "TIMEZONE", fragment.getEntity ( "userTimeZone", null ) ) ;
        bind.setFieldValue ( "MSUSRTYPE", fragment.getEntity ( "userType", null ) ) ;
        bind.setFieldValue ( "UISKIN", fragment.getEntity ( "userUiSkin", null ) ) ;
    }

    /*
        Operation Return - login
    */

    public final void getReturnParameter_LOGIN ( com.lansa.jsm.service.SOAPAgentResponse response, com.lansa.jsm.service.SOAPAgentBind bind ) throws Exception
    {
    }

    /*
        Operation Call - login
    */

    public final com.lansa.jsm.service.SOAPAgentResponse callOperation_LOGIN ( com.lansa.jsm.service.SOAPAgentRequest request, String user, String password, String url ) throws Exception
    {
        com.sforce.soap.enterprise.SforceServiceLocator locator = new com.sforce.soap.enterprise.SforceServiceLocator () ;

        String endPoint = locator.getSoapAddress () ;

        if ( url != null )
        {
            endPoint = url ;
        }

        com.sforce.soap.enterprise.SoapBindingStub stub = (com.sforce.soap.enterprise.SoapBindingStub)locator.getSoap ( new java.net.URL ( endPoint ) ) ;

        if ( user != null && password != null )
        {
            stub.setUsername ( user ) ;

            stub.setPassword ( password ) ;
        }

/*

    Add SOAP header

*/


org.apache.axis.message.SOAPHeaderElement elementHead = new org.apache.axis.message.SOAPHeaderElement ("", "SessionHeader");
 

javax.xml.soap.SOAPElement elementsessionId = elementHead.addChildElement ( "sessionId" ) ;

elementsessionId.addTextNode ( "HOW DO I GET THE SESSIONID IN HERE?" );

stub.setHeader ( elementHead ) ;

 

/*

   End SOAP header
*/

        request.traceStub ( stub ) ;

        return new com.lansa.jsm.service.SOAPAgentResponse ( stub.login( request.getParameterValueString ( "USERNAME" ), request.getParameterValueString ( "PASSWORD" ) ) ) ;
    }

    /*
        Operation - upsert
    */

    public final void setOperation_UPSERT ()
    {
    }

    /*
        Operation Request - upsert
    */

    public final void prepareRequest_UPSERT ( com.lansa.jsm.service.SOAPAgentRequest request ) throws Exception
    {
        request.prepareParameter ( "EXTERNALIDFIELDNAME", java.lang.String.class, false, false ) ;
        request.prepareParameter ( "SOBJECTS", com.sforce.soap.enterprise.sobject.SObject.class, true, true ) ;
        request.prepareFragment ( "SOBJECTS", new String[] { "UPSERTOBJ" }, com.sforce.soap.enterprise.sobject.SObject.class, true, true, null ) ;
        request.prepareList ( "SOBJECTS", new String[] { "UPSERTOBJ", "OBJNAME" }, java.lang.String.class, true, false, "setFieldsToNull" ) ;
    }

    /*
        Operation Parameter - upsert
    */

    public final void setParameter_UPSERT_EXTERNALIDFIELDNAME ( com.lansa.jsm.service.SOAPAgentParameter parameter,

 

    etc... 

 

 

 

 

this is the my generated message i sent:

 

 

<?xml version="1.0" encoding="UTF-8" ?>
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <soapenv:Header>
- <SessionHeader soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
  <sessionId>HOW DO I GET THE SESSIONID IN HERE?</sessionId>
  </SessionHeader>
  </soapenv:Header>
- <soapenv:Body>
- <upsert xmlns="urn:enterprise.soap.sforce.com">
  <externalIDFieldName>mskey__c</externalIDFieldName>
- <sObjects>
  <ns1:fieldsToNull xmlns:ns1="urn:sobject.enterprise.soap.sforce.com">34</ns1:fieldsToNull>
  <ns2:Id xmlns:ns2="urn:sobject.enterprise.soap.sforce.com">11111</ns2:Id>
  </sObjects>
  </upsert>
  </soapenv:Body>
  </soapenv:Envelope>