简体   繁体   English

WCF服务通过SOAP 1.1接受xCBL XML

[英]WCF service to accept xCBL XML via SOAP 1.1

I am tasked with developing a web service end point to accept Purchase Orders from a customer's middleware system. 我的任务是开发一个Web服务端点,以接受来自客户中间件系统的采购订单。

How do I create a WCF Service that accepts this given payload (example by customer) via SOAP 1.1? 我如何创建一个通过SOAP 1.1接受给定有效负载(由客户举例)的WCF服务?

Following is a excerpt 以下是节选

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV = "http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns0:Order xmlns:ns0 = "rrn:org.xcbl:schemas/xcbl/v4_0/ordermanagement/v1_0/ordermanagement.xsd">
  <ns0:OrderHeader>
    <ns0:OrderNumber>
      <ns0:BuyerOrderNumber>3000278673</ns0:BuyerOrderNumber>
    </ns0:OrderNumber>
    <ns0:OrderIssueDate>2012-03-06T14:04:09</ns0:OrderIssueDate>
    <ns0:OrderReferences>
      <ns0:AccountCode>
        <ns1:RefNum xmlns:ns1 = "rrn:org.xcbl:schemas/xcbl/v4_0/core/core.xsd">TEST CUSTOMER</ns1:RefNum>
      </ns0:AccountCode>
      <ns0:OtherOrderReferences>
        <ns1:ReferenceCoded xmlns:ns1 = "rrn:org.xcbl:schemas/xcbl/v4_0/core/core.xsd">
          <ns1:ReferenceTypeCoded>DocumentNumber</ns1:ReferenceTypeCoded>


    <ns1:ReferenceTypeCodedOther>3000278673</ns1:ReferenceTypeCodedOther>
      <ns1:PrimaryReference>
        <ns1:RefNum/>
      </ns1:PrimaryReference>
      <ns1:ReferenceDescription>IDoc Number</ns1:ReferenceDescription>
    </ns1:ReferenceCoded>
  </ns0:OtherOrderReferences>
</ns0:OrderReferences>

I tried to create a XSD from this and generate classes via that but it failed because it couldn't recognise certain types. 我试图从中创建一个XSD并通过它生成类,但是它失败了,因为它无法识别某些类型。

Full Documents: ( WSDL definition ) ( XCBL_PO_SOAP definition ) ( xCBL Schema ) 完整文档:( WSDL定义 )( XCBL_PO_SOAP定义 )( xCBL架构

I have two questions 我有两个问题

1. How do I create the required service interface from this? 1.如何从中创建所需的服务接口?

Or Alternatively 或者

2. When the supplier transmits the above payload can I model my wcf service to just accept a string and then later use LINQ to query the XML? 2.当供应商传输上述有效负载时,我可以对我的wcf服务进行建模以仅接受一个字符串,然后在以后使用LINQ查询XML吗? When the customer says they use xCBL and SOAP 1.1 is this a viable approach? 当客户说他们使用xCBL和SOAP 1.1时,这是否可行?

        //Example
        public string SubmitPurchaseOrder(string XMLPayload){
          return ProcessXmlThroughLinq(XMLPayload);
        }

For anyone who is facing similar issues use the svcutil.exe. 对于面临类似问题的任何人,请使用svcutil.exe。

//The WSDL file(s) is in C:\test\.
svcutil.exe /t:code /serviceContract /out:"C:\test\PurchaseOrder.cs" "C:\test\*"

PS. PS。 Don't worry about it not having any SOAPAction in SOAP Headers. 不用担心它在SOAP Header中没有任何SOAPAction。 The message body namespace will indicate to the service what operation to use. 消息主体名称空间将向服务指示要使用的操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM