• tony534
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 2
    Replies

Hi, 

 

I read the salesforce api document and blog()and tried to call the web service with WSC, but I don't know how can I call the custom web service via WSC.

 

Any suggestion will be appreciated.

How can we create indexes on some standard/custom fields(long text area) in custom object?

 

Thanks for any help.

 

 

I generated an apex class from the WSDL class generator.

From the stub,  before I invoke  "UploadFile(String Token,UploadSeek.xmlFastlaneFile_element xmlFastlaneFile)" method.
I have to initial the "xmlFastlaneFile", but the "xmlFastlaneFile_element" class definition is

public class xmlFastlaneFile_element {
        private String[] apex_schema_type_info = new String[]{'http://webservices.seek.com.au','true','false'};
        private String[] field_order_type_info = new String[]{};
    }
 
I have to input xml file to the class "xmlFastlaneFile_element"
Also I noticed input XML file  connect to the <s:any/> in the wsdl file.
the final request soap like:
POST /FastLanePlus.asmx HTTP/1.1
Host: webservices.seek.com.au
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://webservices.seek.com.au/UploadFile"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <UploadFile xmlns="http://webservices.seek.com.au">
      <Token>string</Token>
      <xmlFastlaneFile>xml</xmlFastlaneFile>
    </UploadFile>
  </soap:Body>
</soap:Envelope>
the problem is that I don't know how to transfer XML file to the String[] field_order_type_info in xmlFastlaneFile_element  class. 
the wsdl address:  http://temp003.s3.amazonaws.com/FastLanePlus.wsdl
 ANY help is greatly appreciated.
Regards
wsdl address: http://temp003.s3.amazonaws.com/FastLanePlus.wsdl
Message Edited by tony534 on 10-06-2009 06:51 PM

I followed this tutorial to login salesforce.com using partner api

http://eng.genius.com/blog/2009/07/09/salesforcecom-partner-soap-api-jax-ws-tutorial-part-2/.

 

 

The partner key(client id) is required,  But I contacted the salesforce consultant, they don't know what partner key is, either.

 

Although I can login with any string instead of partner key, I am still curious what partner id(client id) is?

 

Another sample code about parnter key

 

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_header_calloptions.htm

 

 

    // The real Client ID will be an API Token provided by salesforce.com
// to partner applications following a security review.
// For more details, see the Security Review FAQ in the online help

 

 

Appreciate for any help.

Message Edited by tony534 on 10-01-2009 09:04 PM
Is that possible the Java code can insert data to new fields that the client customised in salesforce.com without Java side stub code(jax-ws) changed?

One of my requirement asks that the clients of salesforce.com can change the objects fields, but EC2 side Java code can operate these new fields automatically.
In my opinion, if the fields changed, the stub code must be regenerated, because there is no any method for the new fields.

But my colleague said, Is it possible using .net code. 
 
Thanks for any suggestions
Message Edited by tony534 on 09-22-2009 05:38 PM
  • September 23, 2009
  • Like
  • 0

I am trying to call external web service using Apex, it need to upload an xml file to the web service.

 

According to the stub method, I have to transfer the xml file to String[] field_order_type_info which I have no idea how to do.

 

 

I am quite new to Apex, please help me.

 

Thanks in advance.

 

 

the Web Service WSDL address.

http://test.webservices.seek.com.au/WebserviceAuthenticator.asmx?WSDL

 

 

  the part of generated Apex code from wsdl file

 

//Generated by wsdl2apex

public class webservicesSeekComAu {
public class UploadFileResult_element {
private String[] apex_schema_type_info = new String[]{'http://webservices.seek.com.au','true','false'};
private String[] field_order_type_info = new String[]{};
}
public class UploadFileWithCredentialsResponse_element {
public webservicesSeekComAu.UploadFileWithCredentialsResult_element UploadFileWithCredentialsResult;
private String[] UploadFileWithCredentialsResult_type_info = new String[]{'UploadFileWithCredentialsResult','http://webservices.seek.com.au','UploadFileWithCredentialsResult_element','0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://webservices.seek.com.au','true','false'};
private String[] field_order_type_info = new String[]{'UploadFileWithCredentialsResult'};
}
public class xmlFastlaneFile_element {
private String[] apex_schema_type_info = new String[]{'http://webservices.seek.com.au','true','false'};
private String[] field_order_type_info = new String[]{};
}
public class FastLanePlusSoap {
public String endpoint_x = 'http://test.webservices.seek.com.au/FastLanePlus.asmx';
public Map<String,String> inputHttpHeaders_x;
public Map<String,String> outputHttpHeaders_x;
public String clientCert_x;
public String clientCertPasswd_x;
public Integer timeout_x;
private String[] ns_map_type_info = new String[]{'http://webservices.seek.com.au', 'webservicesSeekComAu'};
public webservicesSeekComAu.UploadFileWithCredentialsResult_element UploadFileWithCredentials(String userName,String password,String role,webservicesSeekComAu.xmlFastlaneFile_element xmlFastlaneFile) {
webservicesSeekComAu.UploadFileWithCredentials_element request_x = new webservicesSeekComAu.UploadFileWithCredentials_element();
webservicesSeekComAu.UploadFileWithCredentialsResponse_element response_x;
request_x.userName = userName;
request_x.password = password;
request_x.role = role;
request_x.xmlFastlaneFile = xmlFastlaneFile;
Map<String, webservicesSeekComAu.UploadFileWithCredentialsResponse_element> response_map_x = new Map<String, webservicesSeekComAu.UploadFileWithCredentialsResponse_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'http://webservices.seek.com.au/UploadFileWithCredentials',
'http://webservices.seek.com.au',
'UploadFileWithCredentials',
'http://webservices.seek.com.au',
'UploadFileWithCredentialsResponse',
'webservicesSeekComAu.UploadFileWithCredentialsResponse_element'}
);
response_x = response_map_x.get('response_x');
return response_x.UploadFileWithCredentialsResult;
}
public webservicesSeekComAu.UploadFileResult_element UploadFile(String Token,webservicesSeekComAu.xmlFastlaneFile_element xmlFastlaneFile) {
webservicesSeekComAu.UploadFile_element request_x = new webservicesSeekComAu.UploadFile_element();
webservicesSeekComAu.UploadFileResponse_element response_x;
request_x.Token = Token;
request_x.xmlFastlaneFile = xmlFastlaneFile;
Map<String, webservicesSeekComAu.UploadFileResponse_element> response_map_x = new Map<String, webservicesSeekComAu.UploadFileResponse_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'http://webservices.seek.com.au/UploadFile',
'http://webservices.seek.com.au',
'UploadFile',
'http://webservices.seek.com.au',
'UploadFileResponse',
'webservicesSeekComAu.UploadFileResponse_element'}
);
response_x = response_map_x.get('response_x');
return response_x.UploadFileResult;
}
}
public class UploadFileWithCredentialsResult_element {
private String[] apex_schema_type_info = new String[]{'http://webservices.seek.com.au','true','false'};
private String[] field_order_type_info = new String[]{};
}
public class UploadFile_element {
public String Token;
public webservicesSeekComAu.xmlFastlaneFile_element xmlFastlaneFile;
private String[] Token_type_info = new String[]{'Token','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] xmlFastlaneFile_type_info = new String[]{'xmlFastlaneFile','http://webservices.seek.com.au','xmlFastlaneFile_element','0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://webservices.seek.com.au','true','false'};
private String[] field_order_type_info = new String[]{'Token','xmlFastlaneFile'};
}
public class UploadFileWithCredentials_element {
public String userName;
public String password;
public String role;
public webservicesSeekComAu.xmlFastlaneFile_element xmlFastlaneFile;
private String[] userName_type_info = new String[]{'userName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] password_type_info = new String[]{'password','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] role_type_info = new String[]{'role','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] xmlFastlaneFile_type_info = new String[]{'xmlFastlaneFile','http://webservices.seek.com.au','xmlFastlaneFile_element','0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://webservices.seek.com.au','true','false'};
private String[] field_order_type_info = new String[]{'userName','password','role','xmlFastlaneFile'};
}
public class UploadFileResponse_element {
public webservicesSeekComAu.UploadFileResult_element UploadFileResult;
private String[] UploadFileResult_type_info = new String[]{'UploadFileResult','http://webservices.seek.com.au','UploadFileResult_element','0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://webservices.seek.com.au','true','false'};
private String[] field_order_type_info = new String[]{'UploadFileResult'};
}
}

 

 

the operation involved:

UploadFile(String Token, webservicesSeekComAu.xmlFastlaneFile_element xmlFastlaneFile);

 

the xmlFastlaneFile_element is on behalf of an xml file.

 

the example of  xml file: 

 
<FastLanePlus UploaderID="1" AgentID="" Version="1.1">
  <Client ID="1" MinJobs="0" MaxJobs="9999999">
    <Job Reference="SK/1" TemplateID="" ScreenID="">
      <Title>Test</Title>
      <SearchTitle>Test</SearchTitle>
      <Description>Test</Description>
      <AdDetails><![CDATA[Test]]></AdDetails>
      <ApplicationEmail></ApplicationEmail>
      <ApplicationURL></ApplicationURL>
      <ResidentsOnly></ResidentsOnly>
      <Items>
        <Item Name="Jobtitle">Test</Item>
        <Item Name="Bullet1">Bullet1</Item>
        <Item Name="Bullet2">Bullet2</Item>
        <Item Name="Bullet3">Bullet3</Item>
        <Item Name="ContactName"></Item>
        <Item Name="PhoneNo">999999</Item>
        <Item Name="FaxNo">999999</Item>
        <Item Name="RefNumber">SK/1</Item>
      </Items>
      <Listing MarketSegments="Main">
        <Classification Name="Location">Melbourne</Classification>
        <Classification Name="Area">MelbourneInner</Classification>
        <Classification Name="WorkType">FullTime</Classification>
        <Classification Name="Classification">Accounting</Classification>
        <Classification Name="SubClassification">Accountant</Classification>
        <Classification Name="Specialisation">Financial</Classification>
      </Listing>
      <Salary Type="AnnualPackage" Min="70000" Max="80000" AdditionalText="$70,000 + bonus" />
      <StandOut IsStandOut="false" LogoID="" Bullet1="" Bullet2="" Bullet3="" />
    </Job>
  </Client>
</FastLanePlus>
 

 

 

Message Edited by tony534 on 08-23-2009 06:40 AM
Message Edited by tony534 on 08-23-2009 03:59 PM
Message Edited by tony534 on 08-23-2009 09:00 PM

I followed this tutorial to login salesforce.com using partner api

http://eng.genius.com/blog/2009/07/09/salesforcecom-partner-soap-api-jax-ws-tutorial-part-2/.

 

 

The partner key(client id) is required,  But I contacted the salesforce consultant, they don't know what partner key is, either.

 

Although I can login with any string instead of partner key, I am still curious what partner id(client id) is?

 

Another sample code about parnter key

 

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_header_calloptions.htm

 

 

    // The real Client ID will be an API Token provided by salesforce.com
// to partner applications following a security review.
// For more details, see the Security Review FAQ in the online help

 

 

Appreciate for any help.

Message Edited by tony534 on 10-01-2009 09:04 PM
Is that possible the Java code can insert data to new fields that the client customised in salesforce.com without Java side stub code(jax-ws) changed?

One of my requirement asks that the clients of salesforce.com can change the objects fields, but EC2 side Java code can operate these new fields automatically.
In my opinion, if the fields changed, the stub code must be regenerated, because there is no any method for the new fields.

But my colleague said, Is it possible using .net code. 
 
Thanks for any suggestions
Message Edited by tony534 on 09-22-2009 05:38 PM
  • September 23, 2009
  • Like
  • 0