Tag: 肥皂

如何在C#中将Raw XML转换为SOAP XML?

我有一些从XML Serializer生成的xml。如何将其转换为SOAP XML?…我正在尝试做它的ASP.NET C#…请帮帮我

为Azure webapp上托管的SOAP WCF添加简单的安全性

我在Azure应用程序上托管了一个SOAP WCF。 此服务仅由服务器使用,不包含UI。 我只需要一个服务帐户来授权我的WCF。 我不能使用oauth,因为它是SOAP。 我已经阅读了一些关于ACS的内容,但在我的案例中似乎有些过分,因为我只想使用一个帐户来保护我的WCF。 我的想法是,我将利用Azure AD在那里建立一个服务帐户并使用它来保护服务。 这甚至可以在Web应用程序上使用,还是需要将其托管在Web角色上? 在任何情况下,我如何根据我的前提在我的WCF上实现简单的安全性?

如何处理WCF故障exception

我试图在开源客户端应用程序中添加有关SOAP错误的更多信息。 客户端设置为在遇到任何SOAP故障时调用“HandleFault”。 Handle Fault方法如下所示: public static void HandleFault(Message message) { MessageFault fault = MessageFault.CreateFault(message, Int32.MaxValue); throw System.ServiceModel.FaultException.CreateFault(fault, typeof(PermissionDeniedFault), typeof(EndpointUnavailable), typeof(InvalidRepresentation), typeof(UnwillingToPerformFault), typeof(CannotProcessFilter), typeof(AnonymousInteractionRequiredFault) ); } 以下是SOAP Fault的一部分,当我尝试执行诸如从客户端将电话号码更改为无效格式之类的操作时,将其作为“消息”传递。 Sender a:InvalidRepresentation The request message contains errors that prevent processing the request. OfficePhone (123)456-7890 ValueViolatesRegularExpression The specified attribute value does not satisfy the regular expression. 11042dda-3ce9-4563-b59e-d1c1355819a4 每当遇到那个Fault时,客户端只返回“请求消息包含阻止处理请求的错误。”,我想在客户端重新抛出exception之前包含“ AttributeRepresentationFailure […]

System.Web.Services.Protocols.SoapException:服务器无法识别HTTP标头SOAPAction的值:

当我尝试在Web服务上调用方法时,会发生exception: System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://localhost:53460/3Development/MyWebService.asmx/GetBasePath. at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest() at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message) at System.Web.Services.Protocols.SoapServerProtocol.Initialize() at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) Web服务的命名空间: [WebService(Namespace = “http://internaltest.temp.us/MyWebService.asmx”)] 我做了一些研究,发现这个exception流程是因为项目中引用的Web服务命名空间与服务器Web服务的命名空间不同,但我尝试删除Web引用并在项目中再次添加它,但结果仍然是相同。 我的情况类似于下面的文章: Server did not recognize the value of HTTP Header SOAPAction 来自文章: 所以基本上Web服务从http://foo.com/servicename转移到http://bar.com/servicename但是Web服务的“命名空间”仍然是http://foo.com/servicename,因为没有人改变了 问题是: 如何更改Web引用的命名空间?

soap 1.1的服务堆栈序列化例外

请求消息: String String String String 响应消息/错误: SerializationException Could not deserialize ‘application/xml’ request using EServices_Response.SendGetAccountNotification’ Error: System.Runtime.Serialization.SerializationException: Error in line 1 position 170. Expecting element ‘SendGetAccountNotification’ from namespace ‘mynamespace’.. Encountered ‘Element’ with name ‘Envelope’, namespace ‘http://schemas.xmlsoap.org/soap/envelope/’. at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver) at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver) at ServiceStack.WebHost.Endpoints.Support.EndpointHandlerBase.DeserializeContentType(Type operationType, IHttpRequest httpReq, String […]

如何使用c#从xml获取节点 – 我做错了什么?

命令空间和XML仍然让我感到困惑。 这是我的XML(来自SOAP请求) 我试图从SOAP响应中提取实际的XML部分(从Foo元素开始): var nsmgr = new XmlNamespaceManager(document.NameTable); nsmgr.AddNamespace(“soap”, “http://schemas.xmlsoap.org/soap/envelope/”); nsmgr.AddNamespace(“”, “http://tempuri.org/”); nsmgr.AddNamespace(“”, “http://tempuri.org/XMLSchema.xsd”); var xml = document.DocumentElement .SelectSingleNode(“Foo”, nsmgr) .InnerXml; 但SelectSingleNode返回null。 我已经尝试了一些不同的变化,但无法使任何工作。 我不明白的是什么?

创建一个wcf服务后,如何判断wsdl中的restful或soap?

我创建了一个服务,然后我看到一个页面说: 您已创建了一项服务。 要测试此服务,您需要创建一个客户端并使用它来调用该服务。 您可以使用命令行中的svcutil.exe工具执行此操作,语法如下: 但是如何判断它是SOAP还是REST服务呢? 我怎么从wsdl等告诉我? 服务配置: 更新: 嗨马克, 我的配置是: 所以基本上我浏览到.svc文件,我看到了一个wsdl的链接。 但是,我如何知道SOAP或REST端点是否存在。 我是否正确配置了它? 谢谢 更新:17:49(英国时间) marc_s更新:18:22(英国时间) Pete,试试这个 – 没有元数据发布,没有 – 只是webHttpBinding – 你不应该再看到任何WSDL了……

记录服务SOAP请求和响应

我试图在C#中记录服务的soap请求和响应消息。 我有一个现成的肥皂扩展,它可以完成所有这些,但是我无法将其添加到服务方法中。 由于我的VS项目中添加了服务引用而不是Web服务引用,因此当我检查此服务的引用文件时,我看不到调用远程服务的方法。 我看到的所有示例都是添加到Web服务,它具有不同的参考格式。 在这种情况下如何记录soap消息?

为什么WCF在遇到302响应时无法调用SOAP服务?

我编写了一个应用程序,它首先要进行WCF调用登录。 我使用服务引用生成了客户端代码。 它适用于将其服务本地安装到其网络的客户端。 然而,还有一个saas环境,这些相同的服务由公司权力控制。 在saas环境中,我被告知登录失败。 调查使用Fiddler,我发现登录服务调用返回HTML,特别是列出.asmx中所有可用方法的网页。 saas环境有一个小怪癖可能导致这里的问题,但我不知道如何validation这是问题,如果问题是如何解决它。 怪癖是服务器重定向(302)呼叫。 客户端代码: client.Endpoint.Address = new EndpointAddress(“http://”+ settings.MyURL +“/ myProduct /webservices / webapi.asmx”); client.DoLogin(用户名,密码); 在重定向之前发送到服务器的原始数据包括s:Envelope XML标记。 发送到重定向的服务器时,请注意缺少的s:Envelope XML标记: 获取https://www.myurl.com/myProduct/webservices/webapi.asmx HTTP / 1.1 Content-Type:text / xml; 字符集= utf-8的 VsDebuggerCausalityData:uIDPo7TgjY1gCLFLu6UXF8SWAoEAAAAAQxHTAupeAkWz2p2l3jFASiUPHh + L / 1xNpTd0YqI2o + wACQAA SOAPAction:“ http://Interfaces.myProduct.myCompany.com/DoLogin ” Accept-Encoding:gzip,deflate 主持人:www.gotimeforce2.com 连接:保持活力 我如何让这个愚蠢的事情发挥作用? 编辑:值得注意的是,我使用的是WCF / svcutil.exe / service-reference,而不是旧的ASMX / wsdl.exe / […]

通过HTTPS进行WCF并签署正文

我有一个我想要连接的SOAP服务。 它需要通过https访问,并且需要通过证书对其进行签名。 我试过以下代码: 按如下方式设置我的客户端: P4_ServiceReference.P4PortTypeClient client = new P4_ServiceReference.P4PortTypeClient(); client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None; client.ClientCredentials.ServiceCertificate.DefaultCertificate = new X509Certificate2(@”[..].cer”); client.ClientCredentials.ClientCertificate.Certificate = new X509Certificate2(@”[..]”, “somepass”); 甚至更改了我的Reference.cs以在ServiceContractAttribute和OperationContractAttribute上包含ProtectionLevel=ProtectionLevel.Sign 。 会发生什么是创建了wse:security标头,但是正文没有被签名。 该服务返回Element http://schemas.xmlsoap.org/soap/envelope/Body must be signed 。 我错过了什么让身体得到正确的签名?