首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何正确使用带有复杂ksoap2邮件信封的webservice?

如何正确使用带有复杂ksoap2邮件信封的webservice?
EN

Stack Overflow用户
提问于 2011-07-20 21:12:27
回答 1查看 243关注 0票数 0

我需要将该信封发送到the服务:

代码语言:javascript
复制
` <? xml version = "1.0" encoding = "utf-8"?>
 <soap: Envelope xmlns: xsi = "http://wwwenter code here.w3.org/2001/XMLSchema-instance" xmlns: xsd = "http://www.w3.org/2001/XMLSchema" xmlns: soap = "http : / / schemas.xmlsoap.org / soap / envelope / ">
    <soap:Body>
         <getCasesAsString xmlns="http://tempuri.org/">
           <caseFilters> string </ caseFilters>
         </ getCasesAsString>
    </soap: Body>
 </soap: Envelope>`

其中,<caseFilters> string </ caseFilters>过滤器中的"string“应替换为所需的字符串。

更像这样

`

代码语言:javascript
复制
<? xml version = "1.0" encoding = "utf-8"?>
  <soap: Envelope xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: xsd = "http://www.w3.org/2001/XMLSchema" xmlns: soap = "http : / / schemas.xmlsoap.org / soap / envelope / ">
     <soap:Body>
       <getCasesAsString xmlns="http://tempuri.org/">
         <caseFilters>
            <processName>process_name</ processName>
          </ caseFilters>
       </ getCasesAsString>
     </ soap: Body>
  </ soap: Envelope>`

在这个信封里我能做到的最多的是:

`

代码语言:javascript
复制
<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
  <v:Header />
    <v:Body>
       <getCasesAsString xmlns="http://tempuri.org/" id="o0" c:root="1">
         <caseFilters i:type="n0:Process" xmlns:n0="http://tempuri.org/">
           <processName i:type="d:string">PROCESS_NAME</processName>   
         </caseFilters>
       </getCasesAsString>
    </v:Body>
  </v:Envelope>`

但是我收到一个服务器错误,拒绝信封,下面是错误:

`

代码语言:javascript
复制
SoapFault - faultcode: 'soap: Server' faultstring:    System.Web.Services.Protocols.SoapException: The server could not process the request. ---> System.Xml.XmlException: invalid data at the root level. Line 1, position 1.
    in System.Xml.XmlTextReaderImpl.Throw (Exception e)
    in System.Xml.XmlTextReaderImpl.Throw (String res, String arg)
    in System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace ()
    in System.Xml.XmlTextReaderImpl.ParseDocumentContent ()
    in System.Xml.XmlTextReaderImpl.Read ()
    in System.Xml.XmlLoader.Load (XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
    in System.Xml.XmlDocument.Load (XmlReader reader)
    in System.Xml.XmlDocument.LoadXml (String xml)
    in BizAgi.Web.Services.CWorkflowSOAWrapper.getCasesAsString (String caseFilters)
    --- End of stack trace --- inner exception 'faultactor:' null 'detail: org.kxml2.kdom.Node @ 4396c958`

我需要帮助才能正确组装信封。

有人愿意帮我吗?

谢谢。

EN

回答 1

Stack Overflow用户

发布于 2011-07-20 23:02:49

您的信封XML看起来没问题,而且从堆栈跟踪看,getCasesAsString()实际上被调用了。您试图在getCasesAsString()中解析的XML是什么?看起来它在语法上是不正确的--或者也许是正确的,但你使用的是一个奇怪的解析器,它的想法不同。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6762527

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档