开发者

Send arbitrary XML through WCF proxy classes generated from WSDL

I have a hand-written WSDL, along with a few XSD files. A .NET client needs to load an XML document from disk and send its contents as part of the SOAP message. From what I've been reading I think I need to influence svcutil.exe or wsdl.exe to treat this part of the SOAP message as an XmlElement, rather than trying to create types for it.

Is the correct way to do this to specify part of the message as an <xs:any> in the schema?

Is there another way that would allow me to properly specify the message in the schema without using <xs:any>?

I have control over the WSDL and the Java service implementation, and somewhat less control over the WCF client.

Here's a sample message from the WSDL:

<wsdl:message name="TransmitFoo">
  <wsdl:part name="body" element="someprefix:TransmitFooRequest"/>
</wsdl:message>
<wsdl:portType...>
  <wsdl:operation name="TransmitFoo">
    <wsdl:input message="tns:TransmitFoo">
  </wsdl:operation>
</wsdl:portType>

The definition of TransmitFooRequest from the schema is as follows:

<xs:element name="TransmitFooRequest">
  <xs:complexType>
    <xs:all>
      <xs:element name="someValue" type="xs:string"/>
      <xs:element ref="someprefix:bar" />
    </xs:all>
  </xs:complexType>
</xs:element>

<someprefix:bar> is defined in the schema. This is the part that is loaded from disk. I'd like the generated WCF proxy cl开发者_运维技巧ass to have a method signature kind of like this:

TransmitFoo(String someValue, XmlElement bar)

I have seen an answer for a similar requirement where the WSDL is generated from the WCF server; I am doing the opposite, generating WCF client stubs from a WSDL.

  • Interoperable way to send XML data in WCF?

I realize the client could also build the SOAP message and headers completely manually, as in another answer, but re-implementing SOAP is something I'd like to avoid.

  • How to post SOAP Request from .NET?
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜