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
FaridKognozFaridKognoz 

Outbound message & metadata API

I'm using c# to code a listener for outbound messages. When using the sessionId and EnterpriseUrl (from the outbound message) with the sforce api I have no problems accesing data in salesforce, but when traying to use the metadata api it says "No operation available for request".

Is there a way to use the metadata API with the sessionId and Enterprise Url provided in the outbound message?

Thanks;

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell
You'd have to extract the host name from the enterprise server Url, and substitute it into the default metadata api URL.

All Answers

SuperfellSuperfell
You'd have to extract the host name from the enterprise server Url, and substitute it into the default metadata api URL.
This was selected as the best answer
FaridKognozFaridKognoz

Simon:

The URL in the outbound message is: https://na6-api.salesforce.com/services/Soap/c/8.0/511500D80000000MZlL

 

Which is the default metadata api and what should I do exactly?

 

Thanks;

Farid

 

FaridKognozFaridKognoz

That finally worked! I did as you said, replacing the outbound message enterprise URL with the default metadata URL (but keeping the last part of the enterprise url, after the last '/') and use it as the metadata service endpoint and all worked perfectly. Didn't have to login, just used the sessionId provided in the outbound message.

Thanks :D

conversenconversen

Hi

 

I am having same issue, can you please explain me in more details.

 

Thanks

conversen

conversenconversen

Simon,

 

I am having same issue, can you explain me more details:

 

Here is the my situation:

 

I have created workflow rule & outbound message using metadata api & .Net code and it works fine. when oubound message trigger my webservice I dont get all the fields which I setup in outbound message. which WSDL I should use? either partner or metadata wsdl? Can you please send me sample code for both wsdl. Thanks Mangesh

SuperfellSuperfell

The fields sent are the subset defined by the outbound messaging configs. There's an outbound messaging specific WSDL you should be using.

conversenconversen

But I cant everytime get WSDL from outbound message and create listener class. we build the Outbound message programatically for each customer and customer can pickup the fields so that they can synchronize salesforce data with their own tables. I want something common outbound wsdl so dont have to depend on fields or object.

 

so we dont have control which field they choose in UI (our web page).

 

can I used Metadata WSDL to build listener class? do you have any sample code which will give me atleast objects or how to query if I know the fields names?

 

Please let me know.

 

Thanks

Mangesh

 

 

SuperfellSuperfell

There is no common/generic WSDL for OM. But the WSDL just defines what the messages look like, if you know in advance what the messages look like (because your tool does the configuration) you can skip the wsdl altogether and just parse the xml.

conversenconversen

Parse which XML? and where I can get it.

 

Also when I setup the endpoint url, (I have common webservice endpoint URL for all OM), when it gets call.. what code I should write to get updated data, if I know the fields.

 

Can you please update me.

 

Thanks

Mangesh

 

 

SuperfellSuperfell

the XML of the soap message, its the payload of the HTTP request made to your endpoint.

conversenconversen

public class AccountNotificationServiceImpl : INotificationBinding

{
 public AccountNotificationServiceImpl()
 {
  //
  // TODO: Add constructor logic here
  //

 }

 notificationsResponse INotificationBinding.notifications(notifications notifications1)
 {
 AccountNotification[] accounts = notifications1.Notification;
 for (int i = 0; i < accounts.Length; i++)
 {

  AccountNotification notification = accounts[i];
   //Pull the account data out
  Account account = (Account)notification.sObject;
  //We will just echo some values to the console

  string city = account.BillingCity;


  Log.Info.TraceInformation(account.Name);
 }
 }
}

if u see account.BillinfCity added dynamically using our UI, but its not avilabel in WSDL, so throwing error as u explain. but my question how will i get XML in above code.

SuperfellSuperfell

You have to write your own HTTP listener and access the raw http post body, rather than going through the soap stack (which hides all the xml from you, but requires a wsdl)

conversenconversen

Do you have any sample code for this.

 

By the way Thanks for all you help.

 

Thanks

conversen.

SuperfellSuperfell

I don't know of a specific example for this, in .NET you'd write a HttpHandler (i.e. implement IHttpHandler), in particular the OnPost method.

conversenconversen

Ok. Thanks.