【问题标题】:How to send xml doc as a byte array to soap service?如何将xml doc作为字节数组发送到soap服务?
【发布时间】:2018-08-31 15:23:21
【问题描述】:

我有一个XML,我已使用以下PHP 代码将其转换为byteArray

$xmlStr = file_get_contents('demo2.xml'); // read file to string
$byte_array = unpack('C*', $xmlStr); 
echo  implode(',', $byte_array) ; 

我需要将上面的字节数组传递给文件标记中的下面的肥皂信封。 后端网络服务已经写在.net

  <Envelope xmlns="http://example/soap/envelope/">
        <Body>
            <sample  xmlns="http://example.org/">
                <User>[string?]</User>
                <Password>[string?]</Password>
                <File>[anyType?]</File>
            </sample>
        </Body>
    </Envelope>

我正在使用wizdler 拨打服务电话,但我最终收到以下错误:

    The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter  
 The InnerException message was 'Element File from namespace http://example.org/ cannot have child contents to be deserialized as an object. 

Please use XmlNode[] to deserialize this pattern of XML.'.  Please see InnerException for more details.

在上述场景中,如何将xml 文件作为字节数组 发送?

【问题讨论】:

    标签: php .net xml web-services soap


    【解决方案1】:

    我也在寻找它并找到了解决方案。 我觉得你可以试试
    How to send a File(base64Binary) in web service request using SOAP UI ?

    【讨论】:

      猜你喜欢
      • 2012-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-20
      • 1970-01-01
      相关资源
      最近更新 更多