2010-12-08 9 views
11

मैं रिमोट वेब सेवाओं का आह्वान करने के लिए सेल्सफोर्स द्वारा उपयोग की जाने वाली चालान विधि के पैरामीटर जानना चाहता हूं। मेरे पास एक ऐसी सेवा है जिसे मैं आमंत्रित करने में सक्षम हूं, लेकिन सेवा डब्लूएसडीएल सुरक्षा आवश्यकताओं को परिभाषित नहीं करती है, इसलिए मुझे उम्मीद है कि मैं उस जानकारी को मैन्युअल रूप से जोड़ सकता हूं (सेवाएं डब्ल्यूएस-सुरक्षा का उपयोग साबुन हेडर के माध्यम से पारित होती हैं)।Salesforce WebServiceCallout.invoke विधि के लिए पैरामीटर क्या हैं?

यहाँ मैं क्या (लगता है कि मैं) है अब तक पता:

WebServiceCallout.invoke(
    Class servicePort, //Usually set to "this", contains httpheader info as well as ? 
    request_x, //Request object, defining schema, properties, and field order 
    response_map_x, //Response object, defining schema, properties, and field order 
    new String[]{ 
    String endpoint, //Endpoint of the service 
    String ?, //what is this? 
    String methodSchema, //Schema for the request object? 
    String method, //Name of the request method? 
    String responseSchema, //Schema for the response object? 
    String response, //Name of the response object? 
    String responseClass} //Name of the Apex class the response will be converted to 
); 

किसी को भी मदद कर सकते हैं ख़ाली जगह को भरने?

उत्तर

16

यहाँ है कि मैं क्या WebServiceCallout.invoke के लिए अब तक की खोज की है:

Object servicePort - A class with the following variables: 
    String enpoint_x: containing the service endpoint (not sure if necessary) 
    Map<String,String> inputHttpHeaders_x: custom httpHeaders 
    Map<String,String> outputHttpHeaders_x: I think this is the httpHeaders that were returned 
    String clientCertName_x: Used in configuring an SSL cert? 
    String clientCert_x: Used in configuring an SSL cert? 
    String clientCertPassword: Used in configuring an SSL cert? 
    Integer timeout_x: How long (in milliseconds?) to wait for the response 
    String[] ns_map_type_info: The first String is the namespace of the service schema, the second is the name of the object that contains the Apex classes defining the schema objects 
Object request_x - The Apex object that will form the XML schema object 
Map<String, Object> response_map_x - Object is the object that the result is to be unserialized into. String is the name of Object variable. 
String[] { 
    endpoint - The service endpoint 
    soapAction - If the service call requires a soapAction, put it here. Otherwise leave blank. 
    methodSchema - Schema for the request object 
    method - Name of the request method 
    responseSchema Schema for the response 
    responseClass The Apex class that the response will be unserialized into 
} 

इसके अलावा, साबुन हेडर servicePort वर्ग में एक वस्तु बनाने के साथ-साथ एक ही चर नाम के साथ एक स्ट्रिंग द्वारा डाला जा सकता है + "_hns" है कि उस वस्तु के लिए नाम स्थान निर्दिष्ट करता है:

public SoapSecurity Security; 
private String Security_hns = "Security=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"; 

सुप्रीम XML स्कीमा वस्तुओं प्रत्येक बच्चे तत्व (या विशेषता) के लिए चर शामिल करना चाहिए। Arrays जिनके परिवर्तनीय नाम कुछ पैटर्न से मेल खाते हैं परिभाषित करते हैं कि एक्सएमएल में ऑब्जेक्ट चर का उपयोग कैसे किया जाता है।

को देखते हुए दिए उदाहरण में XML:

चर हैं:

public class MyService { 
    public class bar { 
     public String bar; 
     private String[] bar_type_info = new String[] {'bar','http://www.w3.org/2001/XMLSchema','string','0','1','true'}; 
     private String[] apex_schema_type_info = new String[] {'http://schema.myservice.com', 'false', 'false'}; 
     private String[] field_order_type_info = new String[] {'bar'}; 
    } 

    public class foo { 
     public MyService.bar bar; 
     public String a; 
     private String[] bar_type_info = new String[] {'bar','http://schema.myservice.com','bar','0','1','true'}; 
     private String[] a_att_info = new String[] {'a'}; 
     private String apex_schema_type_info = new String[] {'http://schema.myservice.com','false','false'}; 
     private String[] field_order_type_info = new String[] {'bar'}; 
    } 
} 

यहाँ एक (संक्षिप्त) इन वस्तुओं का टूटना है:

<foo a="b"><bar>baz</bar></foo> 

एपेक्स कक्षाएं कुछ इस तरह होगा एक और एक्सएमएल तत्व या एक पाठ नोड का प्रतिनिधित्व करता है, तो एक मिलान _type_info स्ट्रिंग [] उदाहरण के लिए होना चाहिए bar_type_info। इस सरणी के तत्व हैं: 1. XML तत्व नाम 2. स्कीमा 3. एक्सएमएल प्रकार 4. minOccurs 5. maxOccurs (सेट करने के लिए '-1' असीम के लिए) 6. isNillable

हैं चर एक विशेषता का प्रतिनिधित्व करता है, फिर एक मिलान _att_info स्ट्रिंग [] उदाहरण होना चाहिए a_type_info। इसमें बस विशेषता का एक्सएमएल नाम शामिल है।

ध्यान दें कि यदि एक वर्ग चर नाम एक आरक्षित शब्द है, तो _x इसमें संलग्न है उदा। bar_x। यह अन्य चर नामों को प्रभावित करेगा: bar_x_type_info। एपेक्स डेवलपर गाइड नामों के लिए अपने नियम बताती है, लेकिन यदि आप इसे मैन्युअल रूप से बना रहे हैं, तो मुझे लगता है कि आप इसे जो भी नाम चाहते हैं उसे दे सकते हैं - सरणी एक्सएमएल तत्व का नाम निर्धारित करती है ...

मुझे कोई रास्ता नहीं मिला है एक साधारण एक्सएमएल प्रकार का प्रतिनिधित्व करने के लिए जिसमें एक विशेषता भी शामिल है: उदाहरण के लिए 1. स्कीमा 2. 'सही' यदि elementFormDefault = "योग्य" 3:

<foo bar="baz">bar</foo> 

apex_schema_type_info सरणी XML तत्व वर्ग का प्रतिनिधित्व करती बारे में जानकारी निर्दिष्ट करता है।'true' अगर विशेषता FormDefault = "योग्य"

मैं अभी भी 2 और 3 वास्तव में ऐसा करने पर अस्पष्ट हूं, लेकिन ऐसा लगता है कि बाल तत्व (और गुण) माता-पिता नामस्थान का उत्तराधिकारी कैसे हैं (चाहे यह निहित है या होना चाहिए परिणामी एक्सएमएल में निर्दिष्ट)।

field_order_type_info बस बाल तत्वों का क्रम निर्दिष्ट करता है।

कृपया सही या स्पष्ट करने के लिए स्वतंत्र लग रहा है ...

+0

क्या आपको ' बार 'अनुरोध एक्सएमएल उत्पन्न करने का कोई तरीका पता चला? @ जेरेमी – Jair

+0

मुझे डर नहीं है। मैं वर्तमान में बिक्री बल एकीकरण पर काम नहीं कर रहा हूं, मुझे लगता है कि इसे संबोधित किया गया है, लेकिन मुझे वास्तव में पता नहीं है। – Jeremy

+0

धन्यवाद। मुझे लगता है कि यह अभी भी अस्तित्व में है। – Jair

5

Force.com Apex Code Developers Guide - Understanding the Generated Code नहीं है, लेकिन यह अभी काफी WebServiceCallout.invoke(...) के लिए विवरण पर विरल है।

Apex Web Services and Callouts भी है, फिर भी कोई उपयोगी विवरण नहीं है।

उप-मतदान Ideas: Documentation for WebServiceCallout लंबे समय तक मदद कर सकता है।


Salesforce सिर्फ इसलिए अब आप कोड के लिए जाँच वास्तव में क्या हो रहा है देखने के लिए कर सकते हैं Github पर wsdl2apex का एक खुला स्रोत रिलीज किया है,। Announcing the Open-Source WSDL2Apex Generator

संबंधित मुद्दे