function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
reputationdemonreputationdemon 

Using Pentaho and API - SOAPaction issue

Hi,

 

I am relatively new to the API. I am send a request using an XML file I have created using Pentaho.

 

I am getting the error - 'SOAPAction HTTP header missing'

 

How do you specify a SOAPaction if you are not using a web page to access the API?

 

My sample XML :-

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:partner.soap.sforce.com"><soapenv:Header><urn:SessionHeader><urn:sessionId><b>00D80000000dSyn!AQIAQGjxY1K2T3lPrUqxAYjvS5anpICytsIM9SAfipbbuLP9jYP2pXFbVfkceI6YgnuPrLjj8EJhb5E8MSIGtHGUcg3Knwkn</b></urn:sessionId></urn:SessionHeader></soapenv:Header><soapenv:Body><urn:fieldList><b>Id, RecordTypeId</b></urn:fieldList><urn:sObjectType><b>Account</b></urn:sObjectType>

<urn:Optimus_User_ID__c><b>140946</b></urn:Optimus_User_ID__c>

<urn:Optimus_User_ID__c><b>144402</b></urn:Optimus_User_ID__c>

<urn:Optimus_User_ID__c><b>144404</b></urn:Optimus_User_ID__c>

<urn:Optimus_User_ID__c><b>144406</b></urn:Optimus_User_ID__c>

</urn:retrieve></soapenv:Body></soapenv:Envelope>

 

Any help would be great - Just point me in the right direction!

 

Thanks in advance.

Best Answer chosen by Admin (Salesforce Developers) 
reputationdemonreputationdemon

Simon.

 

I get the same message even if I use a different select (Name) :-

 

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:partner.soap.sforce.com"><soapenv:Header><urn:SessionHeader><urn:sessionId>00D80000000dSyn!AQIAQO_66z3ZvU5C.VtoXm26eB5.ozaR8Z30rmHIGir25xIoHItZuTjkrZu19LBpuI2hkVHocNlALEOI8mg6_bOw4z22pA.B</urn:sessionId></urn:SessionHeader></soapenv:Header><soapenv:Body><urn:retrieve><urn:fieldList>Optimus_User_ID__c,Id, RecordTypeId</urn:fieldList><urn:sObjectType>Account</urn:sObjectType>

<urn:query>SELECT RecordTypeId FROM Account WHERE Name='Latroy Campbell'</urn:query>

</urn:retrieve></soapenv:Body></soapenv:Envelope>

 

I will do some more googling on the query format but if you have any other ideas?

 

Thanks,

All Answers

SuperfellSuperfell

The soap 1.1. specification requires SOAP request made over HTTP to include a HTTP called SOAPAction, I don't know what Pentaho is, but if its a soap client, it should include the ability to specify this header.

 

Once you get that resolved, your next problem is going to be that your request isn't valid, it looks like you might be trying to call retreive, but you have no retreieve element in there, and the Ids should be the 18 character long salesforce Ids of the records of interest.

reputationdemonreputationdemon

Simon,

 

Thanks for your reply.

 

1) Pentaho is an ETL tool (just like Informatica). I am using this to form the XML for the request.

 

I don't know how to specify the SOAPaction in the message header ?

 

2) Thanks for catching the '</retrieve'. I guess examples on the 'Sample SOAP messages' on DeveloperForce are not 100% correct. I have fixed this.

 

3) I tried to use cURL (where you can specify the SOAPaction as a parameter) for the request but get 'Content is not allowed in prolog' , which usually means there is a 'space' before the '<?xml version="1.0" encoding="utf-8"?>' but there is not.

 

I will continue to debug but if you have any other ideas that would be great.

 

I appreciate your help.

reputationdemonreputationdemon

Hi,

 

Just an update when calling cURL , I have been debugging and now get a message 'Unexpected element {}b during simple type deserialization'.

 

After googling I have not really come up with a reason why I am getting this. XML :-

 

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:partner.soap.sforce.com"><soapenv:Header><urn:SessionHeader><urn:sessionId><b>00D80000000dSyn!AQIAQGjxY1K2T3lPrUqxAYjvS5anpICytsIM9SAfipbbuLP9jYP2pXFbVfkceI6YgnuPrLjj8EJhb5E8MSIGtHGUcg3Knwkn</b></urn:sessionId></urn:SessionHeader></soapenv:Header><soapenv:Body><urn:fieldList>Id, RecordTypeId</urn:fieldList><urn:sObjectType>Account</urn:sObjectType>

<urn:Optimus_User_ID__c>140946</urn:Optimus_User_ID__c>

<urn:Optimus_User_ID__c>144402</urn:Optimus_User_ID__c>

<urn:Optimus_User_ID__c>144404</urn:Optimus_User_ID__c>

<urn:Optimus_User_ID__c>144406</urn:Optimus_User_ID__c>

</soapenv:Body></soapenv:Envelope>

 

Any ideas?

 

Thanks,

SuperfellSuperfell

You have <b> </b> tags around your sessionId which shouldn't be there.

 

You're also still missing the <retrieve> element which should be the first child of <soapenv:Body>

reputationdemonreputationdemon

Simon,

 

I had been playnig around a bit and removed the 'retrieve' by mistake. I figured that I did not need the <b> thru trial and error.

 

Latest error - MALFORMED_ID: bad id. Looking at the documentation it is expecting a 15 char field (type= id) but the field I am trying to get data for (Optimus_User_ID__c) is a custom field - String(10).

 

So I am not sure how I can get around this?

 

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:partner.soap.sforce.com"><soapenv:Header><urn:SessionHeader><urn:sessionId>00D80000000dSyn!AQIAQPnNHcPEt6HBtcZxmvusr.nqebK7sPh98oxOhnNvCKf32LfHAaMpOMyWiGySVbKM8E.Ds33dSOVFren9ARbzvOjFvmW6</urn:sessionId></urn:SessionHeader></soapenv:Header><soapenv:Body><urn:retrieve><urn:fieldList>Id, RecordTypeId</urn:fieldList><urn:sObjectType>Account</urn:sObjectType>

<urn:Optimus_User_ID__c>140946</urn:Optimus_User_ID__c>

</urn:retrieve></soapenv:Body></soapenv:Envelope>

 

I am using cURL.

 

I continue to troubleshoot.

 

Thanks much for your help so far.

SuperfellSuperfell

retrieve has to use the salesforce Id. If you don't have that, then you'll want to use a query instead, the soql would be "select id, recordtype from account where Optimus_User_ID__c='140946'

reputationdemonreputationdemon

Simon,

 

Yes - I thought that might be the case so I tried :-

 

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:partner.soap.sforce.com"><soapenv:Header><urn:SessionHeader><urn:sessionId>00D80000000dSyn!AQIAQPnNHcPEt6HBtcZxmvusr.nqebK7sPh98oxOhnNvCKf32LfHAaMpOMyWiGySVbKM8E.Ds33dSOVFren9ARbzvOjFvmW6</urn:sessionId></urn:SessionHeader></soapenv:Header><soapenv:Body><urn:retrieve><urn:fieldList>Optimus_User_ID__c,Id, RecordTypeId</urn:fieldList><urn:sObjectType>Account</urn:sObjectType>

<urn:query>SELECT Id, RecordTypeId FROM Account WHERE Optimus_User_ID__c = '140946'</urn:query>

</urn:retrieve></soapenv:Body></soapenv:Envelope>

 

but I get the error  :-

 

MALFORMED_ID: bad id SELECT Id, RecordTypeId FROM Account WHERE Optimus_User_ID__c = &apos;140946&apos

 

I am sure I am getting close ....

SuperfellSuperfell

Then it sounds like the Optimus_User_ID__c field is a lookup field (and so would have an 18 char salesforce Id in it)

reputationdemonreputationdemon

Simon.

 

I get the same message even if I use a different select (Name) :-

 

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:partner.soap.sforce.com"><soapenv:Header><urn:SessionHeader><urn:sessionId>00D80000000dSyn!AQIAQO_66z3ZvU5C.VtoXm26eB5.ozaR8Z30rmHIGir25xIoHItZuTjkrZu19LBpuI2hkVHocNlALEOI8mg6_bOw4z22pA.B</urn:sessionId></urn:SessionHeader></soapenv:Header><soapenv:Body><urn:retrieve><urn:fieldList>Optimus_User_ID__c,Id, RecordTypeId</urn:fieldList><urn:sObjectType>Account</urn:sObjectType>

<urn:query>SELECT RecordTypeId FROM Account WHERE Name='Latroy Campbell'</urn:query>

</urn:retrieve></soapenv:Body></soapenv:Envelope>

 

I will do some more googling on the query format but if you have any other ideas?

 

Thanks,

This was selected as the best answer
reputationdemonreputationdemon

Simon.

 

I have the wrong XML format so I get results after I changed it.

 

I will close this chain but I would like to thank you for all your help!!