+ Start a Discussion
nickwick76nickwick76 

Enterprise WSDL differs from custom web services WSDL - why? How can it be modified?

More than a year ago we took the enterprise WSDL file and sent it to our integration department. They use webmethods and imported it to get all methods and variables. I think that the WSDL file was of version 14.

 

Now the Enterprise WSDL is of version 19.

Here's the code in the WSDL-file for the sObject. It's taken from version 19:

 

<complexType name="sObject">
<sequence>
  <element name="fieldsToNull" type="xsd:string" nillable="true" minOccurs="0" maxOccurs="unbounded" />
  <element name="Id" type="tns:ID" nillable="true" />
  </sequence>
  </complexType>

 

The WSDL file looks pretty much the same but there are a few differences:

- In version 14 there was also an element tag for a xsi-attribute in the WSDL-file.

- When looking at it in Webmethods, version 14 describes the elements with 'urn:fieldsToNull' and 'urn:Id'. Both are optional.

- When looking at it in Webmethods for version 19 these are described with 'ens:fieldsToNull' and 'ens:Id'

 

About 6 months ago we created an Apex class as a webservice that would do similar things with a custom object as are done on standard objects described by the Enterprise WSDL.

 

 The integration department wants us to deliver on the same structure though as the enterprise WSDL.

 For the above example those fields/elements are instead described with 'tns:fieldToNull' and 'tns:Id'. The difference is as you can see 'tns' but also that it says 'fieldToNull' and not 'fieldsToNull'. Furthermore 'tns:Id' is required and not optional. 

 

Is there a way to manipulate these values? The webservice method does upserts and therefore the Id should be optional in my opinion. Can someone explain how I am suppose to work with this and what ens, urn and tns means, works and can be adjusted? I suspect it has something to do with namespaces.

 

Another example in the same manner is how results of upserts are treated. In the Enterprise WSDL UpsertResult is used which has four elements: created, errors, id and success. I am not allowed to use this one in the Apex class web service and return it from my method. Instead I have to create my own. This works alright but my fields are set as optional and I have no idea of how to set them or some of them as required.

 

Thanks / Niklas

 

SuperfellSuperfell

The enterprise WSDL supports custom objects as well as standard objects, so you shouldn't need any apex wsdl, you can do it all via a single copy of the enterprise WSDL.

nickwick76nickwick76

 

The custom object has a master-detail relationship with the Account object.
We need to be able to change the reference of a custom object from one Account to another. This is not possible in a master-detail relationship.
Therefore the idea is to use this new custom webservice to
- Delete a unique external Id of the custom object that is already connected to the Account
- Create a new custom object connected to the Account and add the external Id to it instead. 
This way we have not removed the old custom object but simply deleted an id and instead added a new one that also reference the Account as a detail to the Account Master.
Maybe not the most beautiful solution but it would work.

 

The custom object has a master-detail relationship with the Account object. We need to be able to change the reference of a custom object from one Account to another. This is not possible in a master-detail relationship and therefore we can not use the existing Enterprise WSDL.

 

Therefore the idea is to use this new custom webservice to:

- Delete a unique external Id of the custom object that is already connected to the Account

- Create a new custom object connected to the Account and add the external Id to it instead. 

 

This way we have not removed the old custom object but simply deleted an id and instead added a new one that also reference the Account as a detail to the Account Master.

Maybe not the most beautiful solution but it would work.

 

// Niklas