Skip to main content
5 votes
Accepted

Null pointer Exception in test classes when installing the Custom Metadata Loader

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....
Daniel Ballinger's user avatar
5 votes
Accepted

Bypass the "Apex type not found" error

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 ...
Daniel Ballinger's user avatar
5 votes
Accepted

Use Named Credentials with a SOAP WSDL2APEX class

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:
smukov's user avatar
  • 5,613
5 votes
Accepted

Issue with SOAP Header created via Apex

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>...
Daniel Ballinger's user avatar
4 votes
Accepted

Tracing the request.xml sent using apex callout

You can't see the full CALLOUT_REQUEST from a Sandbox. See the idea - View Callout Request and Response XML in Sandbox. We can't do this without blowing up the debug logs. Debug logs can only be 2MB, ...
Daniel Ballinger's user avatar
4 votes

Make RPC/Encoded callouts from Apex

One option would be to craft the raw HttpRequest yourself and then parse the response. A tool like SoapUI would be really useful here. You could use it to generate sample requests and responses. Then ...
Daniel Ballinger's user avatar
4 votes
Accepted

SOQL retrieve limited?

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 ...
Daniel Ballinger's user avatar
4 votes

Creating Data Extension using Apex (WSDL2Apex)

The method to target is below public exacttargetComWsdlPartnerapi.CreateResponse_element Create(exacttargetComWsdlPartnerapi.CreateOptions Options,exacttargetComWsdlPartnerapi.APIObject[] Objects) { ...
Mohith Shrivastava's user avatar
4 votes
Accepted

What is the meaning of array elements of *type_info variables in SOAP / WSDL auto-generated Apex classes?

The details are fairly well covered in What are the parameters for the Salesforce WebServiceCallout.invoke method? From Jeremy's answer: If the variable represents another XML element or a text node, ...
Daniel Ballinger's user avatar
3 votes

Test Class for WSDL2Apex class generated by Salesforce Partner WSDL

I made a alternative version of WSDL2Apex that can also generate the test classes for coverage and the Mock. You can get it via the FuseIT SFDC Explorer for free (Disclaimer: This is from my current ...
Daniel Ballinger's user avatar
3 votes
Accepted

Apex callout fails suddenly

Check the debug log for the raw CALLOUT_RESPONSE. You might need to do this in a developer edition org to see it. An h4 in the response suggests you are getting an HTML page back in the response. ...
Daniel Ballinger's user avatar
3 votes

WSDL2Apex Ignoring Namespace

WSDL to Apex doesn't support referencing elements from a different namespace: Apex also supports the following schema constructs: xsd:all, in Apex code saved using API version 15.0 and later xsd:...
Pr0tput's user avatar
  • 112
3 votes

How to make a SOAP call using APEX Class?

If your WSDL is proving to be problematic with the built in wsdl2apex implementation that Salesforce provides you could also try the version they make available via GitHub. Another alternative is the ...
Daniel Ballinger's user avatar
3 votes
Accepted

WSDL2Apex: How to edit Paypal WSDL because of few XSD schema imports?

That's an interesting WSDL that presents a number of challenges to import into Salesforce. I've been able to generate the Apex classes for it using the FuseIT SFDC Explorer Wsdl2Apex functionality (...
Daniel Ballinger's user avatar
3 votes
Accepted

Apex callout exception when making hitting an external Service

The reason for this erro was , I was passing the username and password in the wrong way in Http header like below: sample.inputHttpHeaders_x = new Map<String, String>(); sample....
SfdcBat's user avatar
  • 4,821
3 votes

Alter WSDL2APEX Classes for callout tracking

The wsdl2apex generated classes will include the inputHttpHeaders_x and outputHttpHeaders_x members. You can use inputHttpHeaders_x to send additional HTTP headers in on the request and ...
Daniel Ballinger's user avatar
3 votes

When can or can't I use Wsdl2Apex?

The web based version of WSDL2Apex is ultimately a code generator for WebServiceCallout.invoke. If you use it then you generally get the limitations for both WSDL2Apex and WebserviceCallout.invoke. ...
Daniel Ballinger's user avatar
3 votes
Accepted

FuseIT WSDL2Apex Error: Missing namespace for operation

I just tried to process the WSDL you provided. The error was: Missing namespace for operation: [doAction] PortType:COINSInterfacePort Parameter name: Input.Message.Namespace This corresponds to ...
Daniel Ballinger's user avatar
3 votes
Accepted

Script Too Large Error While Generating Apex Classes Using Metadata WSDL

When I've wanted to invoke this API from Apex in the past I have used this already generated and modified code: Apex Wrapper Salesforce Metadata API though it looks like it hasn't have much ...
Keith C's user avatar
  • 136k
3 votes
Accepted

Importing Wsdl2Apex with multiple wsdl:part in a wsdl:message

Unfortunately I don't think you are going to be able to use wsdl2apex and the corresponding WebServiceCallout.invoke() to call these multipart methods. As you have observed, the init message is ...
Daniel Ballinger's user avatar
2 votes
Accepted

When can or can't I use Wsdl2Apex?

[TL;DR;] It depends on how confortable you are with your coding skill. -- You can use the WSDL2Apex tool anytime the webservice you want to call has a wsdl that you can use (believe me, sometimes ...
Fernando Gavinho's user avatar
2 votes
Accepted

Can I take a WSDL from an external system and use it in Salesforce as the format that Salesforce should accept?

Generally speaking there isn't automated support to implement a predefined WSDL someone else provided in Salesforce. Salesforce has expectations around how the Session will be handled in the header. A ...
Daniel Ballinger's user avatar
2 votes

Apex callout exception when making hitting an external Service

To debug this issue you can create a temporary RequestBin URL by going to https://requestb.in/ - 1. Click on "Create a RequestBin" and keep this window open 2. Copy this URL and add to the remote ...
LakhanP's user avatar
  • 831
2 votes
Accepted

Adding security on transport layer level

You can add custom headers as described in SOAP Services: Defining a Class from a WSDL Document, as demonstrated below: docSample.DocSamplePort stub = new docSample.DocSamplePort(); stub....
sfdcfox's user avatar
  • 497k
2 votes
Accepted

How to I construct Request for wsdltoApex class

The response Missing wsse:Security header in request indicates the target service is expecting a WSSE Security header on the request. This isn't usually directly supported if you are using Wsdl2Apex ...
Daniel Ballinger's user avatar
2 votes

wsdl2apex- Generating class

They can be added manually, although it can be quite tedious. I would recommend regenerating the classes if possible. It is likely to be less error prone. However, if you've already extended ...
NSjonas's user avatar
  • 10.2k
2 votes

Test Class for WSDL2Apex class generated by Salesforce Partner WSDL

You will have to use a Mock class. You can find the documentation about it here. You can write a mock method for each method included in your wsdl.
Martin Lezer's user avatar
  • 7,295
2 votes

apex file Error: Failed to parse wsdl: schema:targetNamespace can not be null

That WSDL only has a SOAP 1.2 address defined in the wsdl:service. WSDL2Apex requires a SOAP 1.1 port type to function. If the WSDL had both Soap 1.1 and 1.2 it would be possible to get it to work, ...
Daniel Ballinger's user avatar
2 votes
Accepted

WSDL Generate Apex

The problem is the xs:extension in the WSDL and the lack of support for it from the native version of WSDL2Apex. You could try and manually modify the generated CompleteOfferResponse class to include ...
Daniel Ballinger's user avatar
2 votes

Wsdl to apex class issue with soap1.2

The FuseIT WSDL2Apex tool can handle a WSDL that is combination of SOAP 1.1 (supported) and SOAP 1.2 (unsupported) definitions. Unfortunately, it is only the SOAP 1.1 elements that are support. It ...
Daniel Ballinger's user avatar

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