手动处理 Soap 发送 - XmlNode:节点类型和属性只读
我必须调用 Web 服务,但手动构建 xml。我选择 System.Xml 来执行此操作,但它给我带来了很多痛苦。
我知道的每个 SOAP 都由 3 个部分组成:
- XmlDeclaration
- 信封的标头或 SOAP-ENV:
- Envelope 信封正文或 SOAP-ENV:Body
问题是我的 XmlDocument 只能包含一个根元素。 (不知道为什么) 如果我这样做,
MyXMLDoc.CreateNode(XmlNodeType.DocumentFragment, "SOAP-ENV", "Envelope", "http://tempuri.org");
它不会让我附加属性。它说这些是只读的。
RESUMING:
我该如何编写 this 但没有根且带有 XmlDeclaration?以及如何调用 Web 服务(使用此 xml)?
-<root>
<SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xs=""http://www.w3.org/2001/XMLSchema"" />
- <SOAP-ENV:Body>
- <ZbcInsertRequest xmlns:ns1="'urn:sap-com:document:sap:soap:functions:mc-style'">
<Destino>qas</Destino>
- <IClrQst>
<Request>foo</Request>
<Proyecto>foofoo</Proyecto>
<Modulocq />
<Titureq>foofoofoo</Titureq>
<Tiporeq />
<Prioridad>0</Prioridad>
<Clasific />
<Asignadoa>foofoofoofoo</Asignadoa>
<Destino>qas</Destino>
<Solicita>foo</Solicita>
<Autoriza>c.foo</Autoriza>
<ModTransp />
<ReqSox>F</ReqSox>
<Notfylst />
<Tipodeploy>Normal</Tipodeploy>
<Paqdeploy>CDVQA00000000</Paqdeploy>
</IClrQst>
- <TRequest>
- <item>
<Trkorr>DESK9A0ZJT</Trkorr>
<Secuencia>0</Secuencia>
<Solicita>c.foo</Solicita>
<Type />
<Id />
<Numero />
<Message />
</item>
</TRequest>
</ZbcInsertRequest>
</SOAP-ENV:Body>
</root>
这是我要连接的 wsdl
<wsdl:definitions targetNamespace="urn:sap-com:document:sap:soap:functions:mc-style">
<wsdl:types>
<xsd:schema targetNamespace="urn:sap-com:document:sap:rfc:functions" elementFormDefault="unqualified" attributeFormDefault="qualified">
<xsd:simpleType name="char1">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char10">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char100">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="100"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char15">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="15"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char20">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="20"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char220">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="220"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char255">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="255"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char30">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="30"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char32">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char50">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="numeric3">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="3"/>
<xsd:pattern value="\d*"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="numeric6">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="6"/>
<xsd:pattern value="\d*"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
<xsd:schema targetNamespace="urn:sap-com:document:sap:soap:functions:mc-style" elementFormDefault="unqualified" attributeFormDefault="qualified">
<xsd:import namespace="urn:sap-com:document:sap:rfc:functions"/>
<xsd:simpleType name="char1">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char10">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char12">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="12"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char120">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="120"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char20">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="20"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char250">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="250"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char3">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="3"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char4">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="4"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char60">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="60"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="date">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10"/>
<xsd:pattern value="\d\d\d\d-\d\d-\d\d"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="numeric5">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="5"/>
<xsd:pattern value="\d*"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="numeric6">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="6"/>
<xsd:pattern value="\d*"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="time">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="8"/>
<xsd:pattern value="\d\d:\d\d:\d\d"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="ZtyEE070">
<xsd:sequence>
<xsd:element name="Trkorr" type="tns:char20"/>
<xsd:element name="As4text" type="tns:char60"/>
<xsd:element name="Trfunction" type="n0:char1"/>
<xsd:element name="Trstatus" type="n0:char1"/>
<xsd:element name="Tarsystem" type="tns:char10"/>
<xsd:element name="Korrdev" type="tns:char4"/>
<xsd:element name="As4user" type="tns:char12"/>
<xsd:element name="As4date" type="tns:date"/>
<xsd:element name="As4time" type="tns:time"/>
<xsd:element name="Strkorr" type="tns:char20"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ZtyEE071">
<xsd:sequence>
<xsd:element name="Trkorr" type="n0:char20"/>
<xsd:element name="As4pos" type="tns:numeric6"/>
<xsd:element name="Pgmid" type="tns:char4"/>
<xsd:element name="Object" type="tns:char4"/>
<xsd:element name="Objname" type="tns:char120"/>
<xsd:element name="Objfunc" type="tns:char1"/>
<xsd:element name="Lockflag" type="tns:char1"/>
<xsd:element name="Gennum" type="tns:char3"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Zclrqstdat">
<xsd:sequence>
<xsd:element name="Request" type="n0:char15"/>
<xsd:element name="Proyecto" type="n0:char50"/>
<xsd:element name="Modulocq" type="tns:char250"/>
<xsd:element name="Titureq" type="tns:char250"/>
<xsd:element name="Tiporeq" type="n0:char30"/>
<xsd:element name="Prioridad" type="n0:char15"/>
<xsd:element name="Clasific" type="n0:char100"/>
<xsd:element name="Asignadoa" type="n0:char50"/>
<xsd:element name="Destino" type="n0:char10"/>
<xsd:element name="Solicita" type="n0:char50"/>
<xsd:element name="Autoriza" type="n0:char50"/>
<xsd:element name="Modtransp" type="n0:char1"/>
<xsd:element name="Reqsox" type="n0:char1"/>
<xsd:element name="Notfylst" type="n0:char255"/>
<xsd:element name="Tipodeploy" type="n0:char50"/>
<xsd:element name="Paqdeploy" type="n0:char15"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Zrequest">
<xsd:sequence>
<xsd:element name="Trkorr" type="n0:char20"/>
<xsd:element name="Secuencia" type="tns:numeric5"/>
<xsd:element name="Solicita" type="n0:char50"/>
<xsd:element name="Type" type="n0:char1"/>
<xsd:element name="Id" type="n0:char20"/>
<xsd:element name="Numero" type="n0:numeric3"/>
<xsd:element name="Message" type="n0:char220"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Bapiret2">
<xsd:sequence>
<xsd:element name="Type" type="n0:char1"/>
<xsd:element name="Id" type="n0:char20"/>
<xsd:element name="Number" type="n0:numeric3"/>
<xsd:element name="Message" type="n0:char220"/>
<xsd:element name="Logno" type="n0:char20"/>
<xsd:element name="Logmsgno" type="n0:numeric6"/>
<xsd:element name="Messagev1" type="n0:char50"/>
<xsd:element name="Messagev2" type="n0:char50"/>
<xsd:element name="Messagev3" type="n0:char50"/>
<xsd:element name="Messagev4" type="n0:char50"/>
<xsd:element name="Parameter" type="n0:char32"/>
<xsd:element name="Row" type="xsd:int"/>
<xsd:element name="Field" type="n0:char30"/>
<xsd:element name="System" type="n0:char10"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TableOfztyEE070">
<xsd:sequence>
<xsd:element name="item" minOccurs="0" maxOccurs="unbounded" type="tns:ZtyEE070"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TableOfztyEE071">
<xsd:sequence>
<xsd:element name="item" minOccurs="0" maxOccurs="unbounded" type="tns:ZtyEE071"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TableOfzrequest">
<xsd:sequence>
<xsd:element name="item" minOccurs="0" maxOccurs="unbounded" type="tns:Zrequest"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="ZbcInsertRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Destino" type="n0:char32"/>
<xsd:element name="EtRequestHeader" minOccurs="0" type="tns:TableOfztyEE070"/>
<xsd:element name="EtRequestObj" minOccurs="0" type="tns:TableOfztyEE071"/>
<xsd:element name="IClrqst" type="tns:Zclrqstdat"/>
<xsd:element name="TRequest" type="tns:TableOfzrequest"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ZbcInsertRequestResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="EtRequestHeader" minOccurs="0" type="tns:TableOfztyEE070"/>
<xsd:element name="EtRequestObj" minOccurs="0" type="tns:TableOfztyEE071"/>
<xsd:element name="Return" type="tns:Bapiret2"/>
<xsd:element name="TRequest" type="tns:TableOfzrequest"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ZbcInsertRequestString">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="EtRequestHeader" minOccurs="0" type="tns:TableOfztyEE070"/>
<xsd:element name="EtRequestObj" minOccurs="0" type="tns:TableOfztyEE071"/>
<xsd:element name="Sdestino" type="xsd:string"/>
<xsd:element name="SiClrqst" type="xsd:string"/>
<xsd:element name="TRequest" type="tns:TableOfzrequest"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ZbcInsertRequestStringResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="EtRequestHeader" type="tns:TableOfztyEE070"/>
<xsd:element name="EtRequestObj" type="tns:TableOfztyEE071"/>
<xsd:element name="Return" type="tns:Bapiret2"/>
<xsd:element name="TRequest" type="tns:TableOfzrequest"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<style/>
<wsdl:message name="ZbcInsertRequest">
<wsdl:part name="parameters" element="tns:ZbcInsertRequest"/>
</wsdl:message>
<wsdl:message name="ZbcInsertRequestResponse">
<wsdl:part name="parameters" element="tns:ZbcInsertRequestResponse"/>
</wsdl:message>
<wsdl:message name="ZbcInsertRequestString">
<wsdl:part name="parameters" element="tns:ZbcInsertRequestString"/>
</wsdl:message>
<wsdl:message name="ZbcInsertRequestStringResponse">
<wsdl:part name="parameters" element="tns:ZbcInsertRequestStringResponse"/>
</wsdl:message>
<sap:Feature name="design_0 " uri="http://www.sap.com/webas/630/soap/features/authentication/">
<sap:Property qname="n1:AuthenticationLevel">
<sap:Option value="n1:None"/>
</sap:Property>
</sap:Feature>
<wsdl:portType name="ZICQ">
<sap:useFeature feature="tns:design_0 "/>
<wsdl:operation name="ZbcInsertRequest">
<wsdl:input message="tns:ZbcInsertRequest"/>
<wsdl:output message="tns:ZbcInsertRequestResponse"/>
</wsdl:operation>
<wsdl:operation name="ZbcInsertRequestString">
<wsdl:input message="tns:ZbcInsertRequestString"/>
<wsdl:output message="tns:ZbcInsertRequestStringResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ZICQSoapBinding" type="tns:ZICQ">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="ZbcInsertRequest">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="ZbcInsertRequestString">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ZICQService">
<wsdl:port name="ZICQSoapBinding" binding="tns:ZICQSoapBinding">
<soap:address location="http://hmxwasd1.hylsamex.com.mx:8000/sap/bc/srt/rfc/sap/ZICQ?sap-client=100"/>
</wsdl:port>
I have to make a call to a webservice but building the xml manually. I've chosen System.Xml to do this but it's causing me a lot of pain.
Every SOAP I know consts of 3 parts:
- The XmlDeclaration
- The Header of the envelope or SOAP-ENV:Envelope
- The
Body of the envelope or
SOAP-ENV:Body
The thing is my XmlDocument only can contain one root element. (Don't know why)
If I do
MyXMLDoc.CreateNode(XmlNodeType.DocumentFragment, "SOAP-ENV", "Envelope", "http://tempuri.org");
It does not let me append attributes. It says those are read only.
RESUMING:
How do I have to do to write this but without the root and with an XmlDeclaration? and how do I call a webservice (with this xml)?
-<root>
<SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xs=""http://www.w3.org/2001/XMLSchema"" />
- <SOAP-ENV:Body>
- <ZbcInsertRequest xmlns:ns1="'urn:sap-com:document:sap:soap:functions:mc-style'">
<Destino>qas</Destino>
- <IClrQst>
<Request>foo</Request>
<Proyecto>foofoo</Proyecto>
<Modulocq />
<Titureq>foofoofoo</Titureq>
<Tiporeq />
<Prioridad>0</Prioridad>
<Clasific />
<Asignadoa>foofoofoofoo</Asignadoa>
<Destino>qas</Destino>
<Solicita>foo</Solicita>
<Autoriza>c.foo</Autoriza>
<ModTransp />
<ReqSox>F</ReqSox>
<Notfylst />
<Tipodeploy>Normal</Tipodeploy>
<Paqdeploy>CDVQA00000000</Paqdeploy>
</IClrQst>
- <TRequest>
- <item>
<Trkorr>DESK9A0ZJT</Trkorr>
<Secuencia>0</Secuencia>
<Solicita>c.foo</Solicita>
<Type />
<Id />
<Numero />
<Message />
</item>
</TRequest>
</ZbcInsertRequest>
</SOAP-ENV:Body>
</root>
Here's the wsdl i'm connecting to
<wsdl:definitions targetNamespace="urn:sap-com:document:sap:soap:functions:mc-style">
<wsdl:types>
<xsd:schema targetNamespace="urn:sap-com:document:sap:rfc:functions" elementFormDefault="unqualified" attributeFormDefault="qualified">
<xsd:simpleType name="char1">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char10">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char100">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="100"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char15">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="15"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char20">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="20"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char220">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="220"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char255">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="255"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char30">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="30"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char32">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char50">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="numeric3">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="3"/>
<xsd:pattern value="\d*"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="numeric6">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="6"/>
<xsd:pattern value="\d*"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
<xsd:schema targetNamespace="urn:sap-com:document:sap:soap:functions:mc-style" elementFormDefault="unqualified" attributeFormDefault="qualified">
<xsd:import namespace="urn:sap-com:document:sap:rfc:functions"/>
<xsd:simpleType name="char1">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char10">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char12">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="12"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char120">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="120"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char20">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="20"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char250">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="250"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char3">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="3"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char4">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="4"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char60">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="60"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="date">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10"/>
<xsd:pattern value="\d\d\d\d-\d\d-\d\d"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="numeric5">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="5"/>
<xsd:pattern value="\d*"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="numeric6">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="6"/>
<xsd:pattern value="\d*"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="time">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="8"/>
<xsd:pattern value="\d\d:\d\d:\d\d"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="ZtyEE070">
<xsd:sequence>
<xsd:element name="Trkorr" type="tns:char20"/>
<xsd:element name="As4text" type="tns:char60"/>
<xsd:element name="Trfunction" type="n0:char1"/>
<xsd:element name="Trstatus" type="n0:char1"/>
<xsd:element name="Tarsystem" type="tns:char10"/>
<xsd:element name="Korrdev" type="tns:char4"/>
<xsd:element name="As4user" type="tns:char12"/>
<xsd:element name="As4date" type="tns:date"/>
<xsd:element name="As4time" type="tns:time"/>
<xsd:element name="Strkorr" type="tns:char20"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ZtyEE071">
<xsd:sequence>
<xsd:element name="Trkorr" type="n0:char20"/>
<xsd:element name="As4pos" type="tns:numeric6"/>
<xsd:element name="Pgmid" type="tns:char4"/>
<xsd:element name="Object" type="tns:char4"/>
<xsd:element name="Objname" type="tns:char120"/>
<xsd:element name="Objfunc" type="tns:char1"/>
<xsd:element name="Lockflag" type="tns:char1"/>
<xsd:element name="Gennum" type="tns:char3"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Zclrqstdat">
<xsd:sequence>
<xsd:element name="Request" type="n0:char15"/>
<xsd:element name="Proyecto" type="n0:char50"/>
<xsd:element name="Modulocq" type="tns:char250"/>
<xsd:element name="Titureq" type="tns:char250"/>
<xsd:element name="Tiporeq" type="n0:char30"/>
<xsd:element name="Prioridad" type="n0:char15"/>
<xsd:element name="Clasific" type="n0:char100"/>
<xsd:element name="Asignadoa" type="n0:char50"/>
<xsd:element name="Destino" type="n0:char10"/>
<xsd:element name="Solicita" type="n0:char50"/>
<xsd:element name="Autoriza" type="n0:char50"/>
<xsd:element name="Modtransp" type="n0:char1"/>
<xsd:element name="Reqsox" type="n0:char1"/>
<xsd:element name="Notfylst" type="n0:char255"/>
<xsd:element name="Tipodeploy" type="n0:char50"/>
<xsd:element name="Paqdeploy" type="n0:char15"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Zrequest">
<xsd:sequence>
<xsd:element name="Trkorr" type="n0:char20"/>
<xsd:element name="Secuencia" type="tns:numeric5"/>
<xsd:element name="Solicita" type="n0:char50"/>
<xsd:element name="Type" type="n0:char1"/>
<xsd:element name="Id" type="n0:char20"/>
<xsd:element name="Numero" type="n0:numeric3"/>
<xsd:element name="Message" type="n0:char220"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Bapiret2">
<xsd:sequence>
<xsd:element name="Type" type="n0:char1"/>
<xsd:element name="Id" type="n0:char20"/>
<xsd:element name="Number" type="n0:numeric3"/>
<xsd:element name="Message" type="n0:char220"/>
<xsd:element name="Logno" type="n0:char20"/>
<xsd:element name="Logmsgno" type="n0:numeric6"/>
<xsd:element name="Messagev1" type="n0:char50"/>
<xsd:element name="Messagev2" type="n0:char50"/>
<xsd:element name="Messagev3" type="n0:char50"/>
<xsd:element name="Messagev4" type="n0:char50"/>
<xsd:element name="Parameter" type="n0:char32"/>
<xsd:element name="Row" type="xsd:int"/>
<xsd:element name="Field" type="n0:char30"/>
<xsd:element name="System" type="n0:char10"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TableOfztyEE070">
<xsd:sequence>
<xsd:element name="item" minOccurs="0" maxOccurs="unbounded" type="tns:ZtyEE070"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TableOfztyEE071">
<xsd:sequence>
<xsd:element name="item" minOccurs="0" maxOccurs="unbounded" type="tns:ZtyEE071"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TableOfzrequest">
<xsd:sequence>
<xsd:element name="item" minOccurs="0" maxOccurs="unbounded" type="tns:Zrequest"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="ZbcInsertRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Destino" type="n0:char32"/>
<xsd:element name="EtRequestHeader" minOccurs="0" type="tns:TableOfztyEE070"/>
<xsd:element name="EtRequestObj" minOccurs="0" type="tns:TableOfztyEE071"/>
<xsd:element name="IClrqst" type="tns:Zclrqstdat"/>
<xsd:element name="TRequest" type="tns:TableOfzrequest"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ZbcInsertRequestResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="EtRequestHeader" minOccurs="0" type="tns:TableOfztyEE070"/>
<xsd:element name="EtRequestObj" minOccurs="0" type="tns:TableOfztyEE071"/>
<xsd:element name="Return" type="tns:Bapiret2"/>
<xsd:element name="TRequest" type="tns:TableOfzrequest"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ZbcInsertRequestString">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="EtRequestHeader" minOccurs="0" type="tns:TableOfztyEE070"/>
<xsd:element name="EtRequestObj" minOccurs="0" type="tns:TableOfztyEE071"/>
<xsd:element name="Sdestino" type="xsd:string"/>
<xsd:element name="SiClrqst" type="xsd:string"/>
<xsd:element name="TRequest" type="tns:TableOfzrequest"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ZbcInsertRequestStringResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="EtRequestHeader" type="tns:TableOfztyEE070"/>
<xsd:element name="EtRequestObj" type="tns:TableOfztyEE071"/>
<xsd:element name="Return" type="tns:Bapiret2"/>
<xsd:element name="TRequest" type="tns:TableOfzrequest"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<style/>
<wsdl:message name="ZbcInsertRequest">
<wsdl:part name="parameters" element="tns:ZbcInsertRequest"/>
</wsdl:message>
<wsdl:message name="ZbcInsertRequestResponse">
<wsdl:part name="parameters" element="tns:ZbcInsertRequestResponse"/>
</wsdl:message>
<wsdl:message name="ZbcInsertRequestString">
<wsdl:part name="parameters" element="tns:ZbcInsertRequestString"/>
</wsdl:message>
<wsdl:message name="ZbcInsertRequestStringResponse">
<wsdl:part name="parameters" element="tns:ZbcInsertRequestStringResponse"/>
</wsdl:message>
<sap:Feature name="design_0 " uri="http://www.sap.com/webas/630/soap/features/authentication/">
<sap:Property qname="n1:AuthenticationLevel">
<sap:Option value="n1:None"/>
</sap:Property>
</sap:Feature>
<wsdl:portType name="ZICQ">
<sap:useFeature feature="tns:design_0 "/>
<wsdl:operation name="ZbcInsertRequest">
<wsdl:input message="tns:ZbcInsertRequest"/>
<wsdl:output message="tns:ZbcInsertRequestResponse"/>
</wsdl:operation>
<wsdl:operation name="ZbcInsertRequestString">
<wsdl:input message="tns:ZbcInsertRequestString"/>
<wsdl:output message="tns:ZbcInsertRequestStringResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ZICQSoapBinding" type="tns:ZICQ">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="ZbcInsertRequest">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="ZbcInsertRequestString">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ZICQService">
<wsdl:port name="ZICQSoapBinding" binding="tns:ZICQSoapBinding">
<soap:address location="http://hmxwasd1.hylsamex.com.mx:8000/sap/bc/srt/rfc/sap/ZICQ?sap-client=100"/>
</wsdl:port>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于您的具体问题:在 SOAP 信封中,Body 元素需要是 Envelope 的子元素。你不能让信封是一个空元素,而正文在它后面。下面的代码显示了如何在 XmlDocument 对象中加载此文档的修改版本。
现在,您可以考虑的另一个选择(如果可能)是不“手动”发送 SOAP 请求,而是使用某种工具(例如 WCF 或其他 SOAP 库)创建一个代理,您可以使用该代理向服务发送请求。这样您的客户端就可以简单地“调用一个方法”,堆栈将负责为您创建 SOAP 信封。
For your specific question: in a SOAP envelope the Body element needs to be a child of the Envelope. You can't have the envelope be an empty element and the body following it. The code below shows how to load a modified version of this document in a XmlDocument object.
Now, another option you can consider (if possible) is not to send the SOAP request "manually", but use some tool (such as WCF or some other SOAP library) to create a proxy which you can use to send requests to the service. That way your client can simply "call a method" and the stack will take care of creating the SOAP envelope for you.