You need to sign in to do that
Don't have an account?
can xml file be parsed to String array?
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>