这里是我迄今发现的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
}
此外,SOAP头可以通过在SERVICEPORT类创建对象以及 使用同一个变量名称的String插入+ “_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架构对象应包含每个子元素(或属性)变量。变量名称匹配某些模式的数组定义了xml中对象变量的使用方式。
对于以下示例XML:
<foo a="b"><bar>baz</bar></foo>
的顶点类将是这样的:
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'};
}
}
这里的这些对象的(简单)击穿:
如果变量表示另一个XML元素或文本节点,则需要匹配_type_info String [] eg bar_type_info。该数组的元素是: 1. XML元素名称 2.架构 3. XML类型 4.的minOccurs 5. maxOccurs的(设置为 '-1' 的无界) 6. isNillable
如果变量代表一个属性,那么必须有一个匹配的_att_info String []例如a_type_info。这只是包含属性的XML名称。
请注意,如果类变量名称是保留字,则_x被附加到它,例如, bar_x。这会影响其他变量名称:bar_x_type_info。 Apex开发人员指南解释了它们的名称规则,但是如果您手动创建它,我认为您可以给它任何名称 - 阵列确定XML元素名称...
我还没有找到方法来表示一个简单的XML类型,它也包含一个属性:例如
<foo bar="baz">bar</foo>
的apex_schema_type_info阵列指定关于由类所表示的XML元素的信息: 1.架构 2. '真',如果将elementFormDefault = “合格” 3。'真'如果attributeFormDefault =“合格”
我仍然相当模糊2和3实际上做什么,但它似乎影响子元素(和属性)如何继承父命名空间(无论是暗示的还是必须的在生成的XML中指定)。
field_order_type_info只是指定子元素的顺序。
请随时纠正或澄清...
你找到了一种方法来生成`酒吧 `请求XML? @Jeremy –
Jair
2014-02-21 15:20:22