我需要将该信封发送到the服务:
` <? 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“应替换为所需的字符串。
更像这样
`
<? 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>`在这个信封里我能做到的最多的是:
`
<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>`但是我收到一个服务器错误,拒绝信封,下面是错误:
`
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`我需要帮助才能正确组装信封。
有人愿意帮我吗?
谢谢。
发布于 2011-07-20 23:02:49
您的信封XML看起来没问题,而且从堆栈跟踪看,getCasesAsString()实际上被调用了。您试图在getCasesAsString()中解析的XML是什么?看起来它在语法上是不正确的--或者也许是正确的,但你使用的是一个奇怪的解析器,它的想法不同。
https://stackoverflow.com/questions/6762527
复制相似问题