• dgrigsby
  • NEWBIE
  • 0 Points
  • Member since 2009
  • Founder | Software Integration Architectural Consultant
  • Grigsby Consulting LLC


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 11
    Replies

I need to call  an external service from VF. I am trying to generate apex classes from WSDL and running into issues for import and includes as shown below.

 

Failed to parse wsdl: Unknown element: import

Failed to parse wsdl: Found schema import from location CLiteratureItems.xsd. External schema import not supported

Failed to parse wsdl: Unsupported Schema element found http://www.w3.org/2001/XMLSchema:include. At: 7:57

 

I have seen some posts on these and suggestion is to rework on the wsdl to bring in the external wsdl's into the same. 

 

Is there any documentation on how to get this resolved. 

 

Really appreciate your help.

Message Edited by DCS on 04-23-2009 01:55 PM
  • April 23, 2009
  • Like
  • 0

I am getting this error while creating apex from WSDL.

 

Unable to find schema for element; {http://www.w3.org/2001/XMLSchema}string

 

this is my wsdlfrom axis2 web service), someone help me?

 

<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.example.org/isms/" targetNamespace="http://www.example.org/isms/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema targetNamespace="http://www.example.org/isms/">
<s:element name="isms">
<s:complexType>
<s:sequence>
<s:element name="in" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="ismsResponse" type="s:string" />
<s:element name="ismsRequest" type="s:string" />
</s:schema>
</wsdl:types>
<wsdl:message name="ismsRequest">
<wsdl:part name="parameters" element="tns:ismsRequest">
</wsdl:part>
</wsdl:message>
<wsdl:message name="ismsResponse">
<wsdl:part name="parameters" element="tns:ismsResponse">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="isms">
<wsdl:operation name="isms">
<wsdl:input message="tns:ismsRequest">
</wsdl:input>
<wsdl:output message="tns:ismsResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ismsSOAP" type="tns:isms">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="isms">
<soap:operation soapAction="http://www.example.org/isms/isms"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="isms">
<wsdl:port name="ismsSOAP" binding="tns:ismsSOAP">
<soap:address location="http://172.168.2.235:8080/axis2/services/isms/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

 

Message Edited by china.leaf on 04-23-2009 01:48 AM
Message Edited by china.leaf on 04-23-2009 02:15 AM
Message Edited by china.leaf on 04-23-2009 02:16 AM

Eclipse creates WSDL version 1.5. But the latest version is 2.0

 

Is there any other tools available?

 

Thanks

  • April 22, 2009
  • Like
  • 0
We are trying to access the external API web service and it requires Username Token in the SOAP header. We were able to generate apex script based on the web service description (we had to simplify the wsdl file and drop some methods to make it fit into 100k chars), but do not see how we can add our security header to the stub before making web service method invokations. We see that HTTP output headers are public in the Apex code of the stub. Is it possible for SF to make the SOAP headers public or suggest an idea how to add our security header?

I'm learning to write apex code for calling out to external webservices. I started out with strikeIrons zipcode lookup. I'm new to webservices, so please help me out. Is this how I should go abt doing it?

1. Get WSDL. Generate apex.(done)

2. Created county__c field in account sObject(done)

3. Write before insert, before update trigger that passes the zipcode to CountyLookupClass.(done)

4. CountyLookupClass calls the @future webservice, passes the authentication parameters(username,password) and also the zipcode. 

5. StrikeIron authenticates. Returns county. 

6. Need to map the returned county name to Account.County__c field, so that it is added/inserted to the force.com database. 

 

Am I right? Here is the trigger

 

trigger CountyLookupTrigger on Account (before insert, before update) {

for(Account a: Trigger.new)
CountyLookupClass.CallWS(a);

}

 

 Apex class in invoke webservice

 

public class CountyLookupClass {


@future(callout=true)
public static void CallWS(String zcode){
//pass zipcode to ZipINfo
//get info
//parse to county__c
//create the stub
ZipLookup.ZipInfoSoap zipl = new ZipLookup.ZipInfoSoap();

//instantiate and setup authentication information

zipl.LicenseInfo = new ZipUser.LicenseInfo();
zipl.LicenseInfo.RegisteredUser = new ZipUser.RegisteredUser();
zipl.LicenseInfo.RegisteredUser.UserID = 'withoutme@gmail.com';
zipl.LicenseInfo.RegisteredUser.Password='******';
//call web service
ZipLookup.SIWsOutputOfZipInfoResult zz = zipl.GetCityState('94131');
String c = zz.ServiceResult.Code;
System.debug('Codeis' + c);
//ZipLookup.ZipInfoResult z = zipl.GetCityState('85281').;

}}

 

 

 

 

How do I test this? Am I doing it right?

 

 

 

And the apex from wsdl2apex.wsdl fom http://www.strikeiron.com/productdetail.aspx?p=436

 

 


 

Message Edited by vviyer on 04-09-2009 10:33 PM
Message Edited by vviyer on 04-09-2009 11:44 PM
Message Edited by vviyer on 04-09-2009 11:45 PM
  • April 09, 2009
  • Like
  • 0

Hi,

 

I am new to SalesForce. We have a requirement to integrate our service with the salesforce.

In  in the Apex refrence pdf(salesforce_apex_language_reference.pdf), they tell to import the wsdl file & map the end point in Remote Setting.

Can any one please give me the sample wsdl with the end point. I tried wsdl like "AmazonWebServices.wsdl, AmazonS3.wsdl, GoogleSearch.wsdl,..."

Since those uses rpc which is not supoorted in salesforce I was not able to import it to generate Apex class.

Can any give me some inputs or some links for service end points which uses 'doucment' type instead of 'rpc'.

 

Thanks

 

  • April 09, 2009
  • Like
  • 0

I am generating apex from a wsdl using wsdl2apex.  The wsdl has complex data type that contains an Apex reserve word "Map"

 

<complexType name="Map">

<sequence>

<element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem"/>

</sequence>

</complexType>

 

This generates a class in apex:

 

 public class Map {

public ntta_login.mapItem[] item;

private String[] item_type_info = new String[]{'item','http://xml.apache.org/xml-soap','mapItem','0','-1','false'};

private String[] apex_schema_type_info = new String[]{'http://xml.apache.org/xml-soap','true'};

private String[] field_order_type_info = new String[]{'item'};

}

 

Apex validation fails with "unexpected token class" because of the reserve word Map being used.

 

I try chaning the class to Map_x but the callback fails from the webservice with:

service callout failed: Unable to parse callout response. Apex type not found for element item

 

Is there a workaround that I can use besides changing the wsdl definition source system?

Thanks

 

Hi all-

 

I'm trying to convert another WSDL and i'm getting the following error.  What is the supported type for a byte?

 

Error: Unsupported schema type: {http://www.w3.org/2001/XMLSchema}byte

blank_page

Hi all-

 

I'm wondering if someone can help me figure out the solution to my problem.  I generated an apex class from the WSDL class generator, and this is part of the output. However, I have been told that I will need to ensure the the SOAP responses are described in the WSDL.  I'm not a SOAP expert so I don't know where to begin...  So, I have posted the two types of responses that come back from our web service provider as well as how its defined in the WSDL.   ANY help is greatly appreciated...

 

 

public csCallCenterWS.CreateNewAccountResult_element CreateNewAccount(String strUser,String strPin,Integer lngSiteID,String strFirstName,String strLastName,String strAccountName,String strAccountType,String strAddress1,String strAddress2,String strCity,String strState,String strZip,String strEmail,String strHomePhone) { csCallCenterWS.CreateNewAccount_element request_x = new csCallCenterWS.CreateNewAccount_element(); csCallCenterWS.CreateNewAccountResponse_element response_x; request_x.strUser = strUser; request_x.strPin = strPin; request_x.lngSiteID = lngSiteID; request_x.strFirstName = strFirstName; request_x.strLastName = strLastName; request_x.strAccountName = strAccountName; request_x.strAccountType = strAccountType; request_x.strAddress1 = strAddress1; request_x.strAddress2 = strAddress2; request_x.strCity = strCity; request_x.strState = strState; request_x.strZip = strZip; request_x.strEmail = strEmail; request_x.strHomePhone = strHomePhone; Map<String, csCallCenterWS.CreateNewAccountResponse_element> response_map_x = new Map<String, csCallCenterWS.CreateNewAccountResponse_element>(); response_map_x.put('response_x', response_x); WebServiceCallout.invoke( this, request_x, response_map_x, new String[]{endpoint_x, 'http://centershift.com/csCallCenter/csCallCenterService/CreateNewAccount', 'http://centershift.com/csCallCenter/csCallCenterService', 'CreateNewAccount', 'http://centershift.com/csCallCenter/csCallCenterService', 'CreateNewAccountResponse', 'csCallCenterWS.CreateNewAccountResponse_element'} ); response_x = response_map_x.get('response_x'); return response_x.CreateNewAccountResult; }

 

 

 

EXPECTED XML RESPONSE

 

ERROR

 

      <Error>
        <ErrorCode>100</ErrorCode>
        <Line>445</Line>
        <Message>Failed to log in User:  Either Username or Password is incorrect or User does not have permission</Message>
      </Error>

 

SUCCESS

 

      <Account>
        <FIRST_NAME>frank</FIRST_NAME>
        <LAST_NAME>sinatra</LAST_NAME>
        <EMAIL_ADDRESS>test@example.com</EMAIL_ADDESS>
        <PASSWORD>438500</PASSWORD>
        <CONTACT_ID>5662413</CONTACT_ID>
        <ACCOUNT_ID>3072405</ACCOUNT_ID>
      </Account>

 

 

HERE IS HOW THE RESPONSE IS DEFINED IN THE WSDL

 

      <s:element name="CreateNewAccountResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="CreateNewAccountResult">
              <s:complexType mixed="true">
                <s:sequence>
                  <s:any />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>

Message Edited by savvyboarder on 02-02-2009 09:03 AM
Message Edited by savvyboarder on 02-02-2009 09:58 AM
Hi there

Does Apex support Secure Web Services. I need to consume an external WS, for one which need to be authenticated.
Authentication is via another WS, which accepts a X509 cert in the request and returns a Binary Security Token in the response.

This token needs to be embedded in all further requests, like this
<soap:Header>
<wsse:Security>
<wsu:Timestamp wsu:Id="Timestamp-2b27a32b-ca9c-4405-b377-4444f63c8f29">
<wsu:Created>2007-02-20T16:36:54Z</wsu:Created>
<wsu:Expires>2007-02-20T16:41:54Z</wsu:Expires>
</wsu:Timestamp>
<wsse:BinarySecurityToken
ValueType="ExperianWASP"
EncodingType="wsse:Base64Binary"
wsu:Id="SecurityToken-f64439f9-c12c-4d09-ac3d-fc478ad19775">
MjAtRTctQ0YtMTUtN0EtODEtNTk...
</wsse:BinarySecurityToken>

In .NET , this can be written as

AuthPlusWS.InteractiveWSWse service = new AuthPlusWS.InteractiveWSWse();
// Add the secure token to the secured service
service.RequestSoapContext.Security.MustUnderstand = false;
service.RequestSoapContext.Security.Tokens.Add(wt);

Is there a way to do this in apex ?

Cheers,
Ritesh
I have been working under the impression that Salesforce SOA does not support WSS security tokens while making external Web Service calls in Apex.  I haven't seen anything in the docs about SOA supporting WSS.

I wanted to get confirmation that this is accurate, that SOA cannot create and include WSS 1.0 security tokens in requests to Web Services.