Web サービスを呼び出す必要がありますが、xml を手動で作成する必要があります。これを行うためにSystem.Xmlを選択しましたが、それは私に多くの苦痛を引き起こしています。
私が知っているすべての SOAP は、次の 3 つの部分で構成されています。
- Xml宣言
- エンベロープのヘッダーまたは SOAP-ENV:Envelope
- エンベロープの本文または SOAP-ENV:Body
問題は、私の XmlDocument には 1 つのルート要素しか含めることができないということです。(理由がわからない) もし私がそうするなら
MyXMLDoc.CreateNode(XmlNodeType.DocumentFragment, "SOAP-ENV", "Envelope", "http://tempuri.org");
属性を追加できません。それらは読み取り専用であると言われています。
再開:
ルートなしで 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>