服务操作和模式映射 [英] Service Operations and Schema mappings

查看:63
本文介绍了服务操作和模式映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Schemas和WCF / Asmx服务操作之间的映射有疑问。
在使用DynamicResolution示例时,我注意到为模式定义的名称空间(CNOrderDoc.xsd)和CanadianService下的操作.asmx(http://globalbank.esb.dynamicresolution.com/canadianservices)map1到1.
我尝试通过复制SubmitOrder方法的输入和输出并将其命名为SubmitOrderNew来添加新的WebMethod到CanadianService。然后指定"SubmitOrderNew"作为我行程中的动作。当我尝试使用这个新添加的方法执行我的行程时,我得到以下异常:

< soap:Fault xmlns:soap =" http://schemas.xmlsoap.org/soap/envelope /"><faultcode>soap:Server</faultcode><faultstring>System.Web.Services.Protocols.SoapException:服务器无法处理请求。 ---&安培; GT; System.NullReferenceException:对象引用未设置为对象的实例。
   at GlobalBank.ESB.DynamicResolution.Canadian.OrderPurchaseWebService.submitOrderNew(OrderDoc orderDoc)
   ---内部异常堆栈跟踪的结束---< / faultstring>< detail />< / soap:Fault>

根据我的分析,它发生了,因为模式仍然有它的根名称是"SubmitOrder"并且它期望根节点是"SubmitOrderNew"。我通过添加具有相同结构的新模式来确认它,但它的根节点被命名为"SubmitOrderNew"。

现在我有几个问题:

I have a question about the mappings between the Schemas and the WCF/Asmx Service operations.
While playing with the DynamicResolution sample I noticed that the namespaces defined for the schemas (CNOrderDoc.xsd) and the operations under CanadianService.asmx (http://globalbank.esb.dynamicresolution.com/canadianservices)map 1 to 1.
I tried to add a new WebMethod to the CanadianService by copying the input and output from SubmitOrder method and named it SubmitOrderNew and then specified "SubmitOrderNew" as the action in my itinerary. I got the following exception when I tried to execute my itinerary with this newly added method:

<soap:Fault xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soap:Server</faultcode><faultstring>System.Web.Services.Protocols.SoapException: Server was unable to process request. ---&gt; System.NullReferenceException: Object reference not set to an instance of an object.
   at GlobalBank.ESB.DynamicResolution.Canadian.OrderPurchaseWebService.submitOrderNew(OrderDoc orderDoc)
   --- End of inner exception stack trace ---</faultstring><detail /></soap:Fault>

Based on my analysis, it's happening because the schema still has it's root name as "SubmitOrder" and it's expecting the root node to be "SubmitOrderNew". I confirmed it by adding a new schema with the same structure but it's root node was named "SubmitOrderNew".

Now I have a few questions about this:


  1. 根据我的分析,ESB传递给目标服务的消息必须具有与目标方法名称(Action)完全相同的根名称。为什么这两者不能不同?我假设消息应该只作为目标操作的参数。

  2. 它也导致了指定命名空间的问题。在我的例子中,模式的目标名称空间命名为 - http://mycompany/schemas/v1.0/typeName,我希望我的WCF服务位于不同的名称空间中。但是,正如我发现的那样,命名空间也应该完全相同。

任何输入都将受到高度赞赏。

Any input will be highly appreciated.

推荐答案



检查您的WSDL,看看您的模式和WCF服务的名称空间是否相同。是的,他们需要相同才能工作。消耗或公开WCF服务的百分之九十的问题直接或间接地与命名空间问题相关。如果命名空间是一致的,问题就会消失。
Hi,

Check your WSDL and see whether the namespaces of your schemas and WCF services are same or not. Yes, they need to be same in order to work. Ninety percent of problems with consuming or exposing WCF services is related directly or indirectly to namespace problems. If the namespaces are consistent, the problems disappear.


这篇关于服务操作和模式映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆