简体   繁体   English

如何正确使用具有复杂 ksoap2 邮件信封的 web 服务?

[英]How to consume webservice with complex ksoap2 mailing envelope correctly?

I need to send to the webservice that envelope:我需要将该信封发送到网络服务:

` <? 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>`

Where "string" in <caseFilters> string </ caseFilters> filter should be replaced by that desire. <caseFilters> string </ caseFilters>过滤器中的“字符串”应由该愿望替换。

More like this更像这样

` `

<? 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>`

the most I was able to make it in this envelope:我能在这个信封里做到的最多:

` `

<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>`

But I get a server error, refusing the envelope, the following error:但我收到服务器错误,拒绝信封,以下错误:

` `

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`

I think these can be id = "o0" c: root = "1" or i: type = "n0: Process"我认为这些可以是 id = "o0" c: root = "1" 或 i: type = "n0: Process"

I need help to correctly assemble the envelope...我需要帮助才能正确组装信封...

someone there willing to help me?有人愿意帮助我吗?

Thank you.谢谢你。

Your envelope XML looks OK, and also from the stack trace looks like getCasesAsString() is actually called.您的信封 XML 看起来不错,而且从堆栈跟踪看起来像getCasesAsString()实际上被调用了。 What is that XML you're trying to parse inside getCasesAsString()?您试图在 getCasesAsString() 中解析的 XML 是什么? Looks like it is not syntactically correct - or maybe it is, but you're using a weird parser which thinks differently.看起来它在语法上不正确 - 或者它可能是,但你使用的是一个奇怪的解析器,它的想法不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM