如何自动化响应类型为ISO-1859的Web服务 [英] How do I automate web service whose response is of type ISO-1859

查看:50
本文介绍了如何自动化响应类型为ISO-1859的Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试自动化基于肥皂的网络服务但是

因为响应内容不是utf-8 / utf-16而面临问题。

我有为自定义编码器创建解决方案,但不知道如何创建它。任何帮助将不胜感激。

谢谢



什么我试过了:



我尝试创建自定义编码器类,其样本在Microsoft页面中但它似乎与我正在做的事情无关我正在创建一个不创建wcf服务的自动化框架

解决方案

假设您指的是此Microsoft示例 [ ^ ],当您通过WCF 调用服务时,它也适用。您只需将其添加到您正在调用的WCF服务的配置中 - 例如:

 <   system.serviceModel  >  
< 扩展程序 >
< bindingElementExtensions >
< add

name = customTextMessageEncoding < span class =code-attribute>

< span class =code-attribute> type = Microsoft.ServiceModel.Samples.CustomTextMessageEncodingElement,CustomTextEncoder,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null < span class =code-attribute>

< span class =code-attribute> / >
< / bindingElementExtensions >
< / extensions >

< 绑定 >
< customBinding >
< binding < span class =code-attribute> name = MyBinding ... >
< customTextMessageEncoding 编码 = iso-8859-1 messageVersion < span class =code-keyword> = Soap11 >
< readerQuotas ... / >
< / customTextMessageEncoding >

< httpTransport

< span class =code-attribute>
......

/ >
< / binding >
< / cust omBinding >
< / bindings >

< 客户 >
< endpoint

address = ...

binding = customBinding

bindingConfiguration = MyBinding

< span class =code-attribute> contract = ...

name = ...

/ >
< / client >
< / system.serviceModel >


I am trying to automate a Soap based web service but
I m facing issues as response content is not of utf-8/utf-16.
I have to create a solution for custom encoders but not sure how to create it.Any help would be appreciated.
Thanks

What I have tried:

I tried creating custom encoder class whose sample is in Microsoft page but It doesn't seem relevant to what I am doing as I am creating a automation framework not creating a wcf service

解决方案

Assuming you're referring to this Microsoft sample[^], it also applies when you're calling services via WCF. You just need to add it to the configuration for the WCF service you're calling - for example:

<system.serviceModel>
    <extensions>
        <bindingElementExtensions>
            <add 

                name="customTextMessageEncoding" 

                type="Microsoft.ServiceModel.Samples.CustomTextMessageEncodingElement, CustomTextEncoder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" 

            />
        </bindingElementExtensions>
    </extensions>

    <bindings>
        <customBinding>
            <binding name="MyBinding" ...>
                <customTextMessageEncoding encoding="iso-8859-1" messageVersion="Soap11">
                    <readerQuotas ... />
                </customTextMessageEncoding>

                <httpTransport 

                    ...

                />
            </binding>
        </customBinding>
    </bindings>
    
    <client>
        <endpoint 

            address="..." 

            binding="customBinding" 

            bindingConfiguration="MyBinding" 

            contract="..." 

            name="..." 

        />
    </client>
</system.serviceModel>


这篇关于如何自动化响应类型为ISO-1859的Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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