14

As in other programming languages, you can generate Apex code starting from the WSDL using the "Generate from WSDL" button present at the top of the Apex Classes list in the Setup UI. The process is described e.g. in SOAP Services: Defining a Class from a WSDL Document. However, there are a number of limitations in that tooling, including that it only ...


11

The Salesforce wsdl2apex tool does not support a number of WSDL features. See Supported WSDL Features That section does say: Apex also supports the following schema constructs: xsd:attribute, in Apex code saved using API version 15.0 and later However, I've found in practice you usually get the Unsupported Schema element found error message that you ...


10

Multi-part messages, seems to be an unsupported feature. <wsdl:message name="XAVRequestMessage"> <wsdl:part name="Body" element="xav:XAVRequest"/> <wsdl:part name="UPSSecurity" element="upss:UPSSecurity"/> </wsdl:message> However you can often work around these issues by editing the WSDL and/or the generated code afterwards (...


7

First off, you should create an integration only user if you haven't already done so. This allows you to control security (or open up access) for the middleware integration. Typically I set the integration user's profile settings so that its password never expires, but it is not absolutely necessary. Second, you have two different WSDL's you can choose ...


7

UPDATE for Winter `16 - Simplify Development of Web Service Callouts by Using Named Credentials Short answer. No, it doesn't appear Named Credentials are supported by Wsdl2Apex. I created minimal Named Credential for a public webservicex web service that doesn't require authentication (to check if it will work for the endpoint URL). Then I tried to ...


6

Here is a blog for the solution i used for the Metadata Apex API WSDL test class. The approach uses a semi-generic WebServiceMock implementation and type instantiation to cover the code. You can obtain 100% coverage with this approach. Note that you don't need to add any real logic to your test, the generated code just needs the return type created and any ...


6

Unfortunately the Enterprise WSDL does not aggregate Apex Web Services defined in the org, only custom objects. I've also confirmed this by writing a short Apex Web Service, downloaded the Enterprise WSDL and searched it for my class and it is not present. Force.com Enterprise WSDL—This API is for most enterprise users who are developing client ...


6

The standard WSDL-->Apex feature does not support including any WSS or WSP headers in the outgoing SOAP request. You will need to forgo the WSDL-->Apex generated classes and instead manually construct the request SOAP message and then invoke the web service using the Apex HTTP callout classes. This thread should be helpful in showing you how to do this - ...


6

Note, the following ideas won't directly solve your issue, but it may lead to the cause. You could try a couple of thinks: Invoking the web service independently of Salesforce. This will help confirm that it is operating as you expect and that the crediantals are valid. Examining the callout request and response from the apex log I've been using soapUI to ...


6

The Enterprise and Partner APIs are intended for usage outside of Salesforce rather than integrating two Salesforce Orgs together. They are typically consumed by languages like Java, .NET, PHP, Ruby, ... As you found, anyType is not supported by Wsdl2Apex. See Supported WSDL Features: The Salesforce datatype anyType is not supported in WSDLs used to ...


6

In my case it turned out to be the oldest problem in the book with callouts. Hopefully this will save someone a couple of minutes head scratching. Just as with the synchronous callouts, to make a callout to an asynchronous web service the domain needs to be listed under: Setup > Administration Setup > Security Controls > Remote Site Settings.


6

Salesforce's Wsdl2Apex doesn't support the xs:attribute element. In this post, @Sonam_SFDC describes how to fix the issue: Here, I understand that the schema contain definition of attribute that is not part of any object/element. In a normal document layout schema, this would permitted in this form for the purposes of defining reusable element ...


5

There is an excellent topic 'Understanding the Generated Code' in the Apex Developers guide here, which describes what your getting from the Apex2WSDL tool and an example of how to use it. Of course each Web Service is different, so I cannot comment on specifically. So here are some general observations. Authentication? I can see that its a basic account ...


5

I haven't tested this, but when you are creating your Named Credential you have the option to tick "Generate Authorization Header", which should do this for you automatically:


5

The problem is occurring in the upsertMetadata SOAP callout in a testing context. The test Cases in CustomMetadataUploadControllerTest are using the MDWrapperWebServiceMock mock for the SOAP requests. However, these aren't mocking a response for upsertMetadata_element. As such it is returning a null response, which then breaks on response_x.result on line ...


4

If you haven't already, you might want to check out what's coming in Winter '13 in the Support for Testing Callouts section to consider how you might design/refactor things down the road. My personal preference has been to roll my own mock support, creating a mock mock framework ;) But I think things are going to get much cleaner with the HttpCalloutMock ...


4

It's not too tough, getting the environemnt setup is the biggest hurdle, after that java is pretty darn close to Apex! Maybe checkout a blog post I made a long time ago, on getting the environment setup. Once you have that done, generate either an enterprise or partner WSDL and off you go. Also, my blog has the info on how to get the WSDL into your Java ...


4

It sounds like you are trying to generate Apex classes based on a WSDL, but you've run into limits with the native tool because of file size? Take a look at the FuseIT SFDC Explorer. It allows you generate Apex from WSDL and solves some of the problems with the Salesforce provided tool.


4

You need to obtain the WSDL from the external application. For example, for PayPal those are available here. So finding those WSDLs for the external service is the first step. Note that it is very common that the WSDL will require some modification before you can generate Apex code from it using the "Generate from Apex" (wsdl2apex) button and in some cases ...


4

The native version of Wsdl2Apex doesn't support {http://www.w3.org/2001/XMLSchema}anyType because WebserviceCallout.invoke can't. By having Account in the methods Arguments and return type Salesforce is going to generate xsd:complexType's for all sorts of supporting types. A number of these will have elements like: <xsd:element name="NewValue" ...


4

The solution is that the wsdl should not contain multiple wsdl:portType and wsdl:binding So remove the unwanted wsdl:portType and its respective wsdl:binding


4

In this particular case you are dealing with the common wsdl:import that .NET adds to web services to handle generic serialization (schemas.microsoft.com.2003.10.Serialization.xsd Schema). Being generic to all web services, it most likely contains a number of elements that you don't use in the base WSDL. The problem elements in question are: <xs:attribute ...


4

No, you can't bypass it when using wsdl2Apex and the corresponding WebServiceCallout.invoke() call. It expects to be able to deserialize the entire response message according to what was defined in the WSDL. Ideally the web service you are integrating with would be versioned. Then you would only need to update the Salesforce implementation when updating the ...


4

lead.setFirstName(sobj[j].getField("FirstName").toString()); The Lead FirstName field is not required. As such, it will return as null via the API if it is not defined. You will need to check if it is null before attempting to convert it to a string. It is likely that you are only getting a subset of records back for the SOQL query as the API user that ...


4

Looking at http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd I see <xsd:complexType name="PasswordString"> <xsd:annotation> <xsd:documentation> This type is used for password elements per Section 4.1. </xsd:documentation> </xsd:annotation> <xsd:simpleContent> <...


3

The WSDL2Apex tool does not support the xsd:extension concept, so types such as CustomField that extend from the Metadata type (which provides the fullName) in the XML Schema do not reflect this relationship in the generated Apex code. You need to manually edit the generated Apex code afterwards. The full steps for preparing a Metadata API generated Apex ...


3

Trimming Options and Recommended Approach. You can either trim the WSDL or trim the resulting Apex class from the WSDL2Apex tool. I recommend the later, as the Apex compiler will warn you if you delete class that is referenced more easily. Start first by removing the static methods (representing the operations from the WSDL) you don't want. Then start by ...


3

I haven't tried it, but essentially they are all just strings. So you could just drop the restrictions and make them strings. Something like: <xsd:element name="Service" type="xsd:string"/> <xsd:element name="MajorVersion" type="xsd:string"/> <xsd:element name="MinorVersion" type="xsd:string"/> Just make sure you follow the restrictions ...


3

As per the documentation here, only the basic XML Schema data types are supported, nor are enum data types (not quite sure why tbh). So the simplest thing to do is to revert to the xsd:string data. You have the following in your XML Schema. <xsd:simpleType name="ServiceType"> <xsd:restriction base="xsd:string"> <xsd:enumeration ...


3

The soap header should be added as a member to the wsdl2apex generated stub class that corresponds to the port. This class will also have the public String endpoint_c = '...'; member. There should also be a String member generated that ends with _hns. This has the namespace mapping for the header. I assume you defined a value for the header member in the ...


Only top voted, non community-wiki answers of a minimum length are eligible