SOAP对象引用未设置为对象的实例

SOAP对象引用未设置为对象的实例,soap,Soap,我正在尝试在ChangeGear 5.0上搜索票证。他们的API利用SOAP请求,当我运行搜索请求时,会出现错误“对象引用未设置为对象的实例”。我已经浏览了关于同一问题的现有主题(有很多),我尝试了所有这些主题,但都没有成功。非必需的参数作为空标记包含,而不是完全忽略,我已经尝试将参数的名称大写,并且我已经确保根据WSDL对请求进行适当的格式化 所提供的ChangeGear 5.0文档规定了如下结构请求: POST /cgweb/cgwebservices/cgwebservices.asmx

我正在尝试在ChangeGear 5.0上搜索票证。他们的API利用SOAP请求,当我运行搜索请求时,会出现错误“对象引用未设置为对象的实例”。我已经浏览了关于同一问题的现有主题(有很多),我尝试了所有这些主题,但都没有成功。非必需的参数作为空标记包含,而不是完全忽略,我已经尝试将参数的名称大写,并且我已经确保根据WSDL对请求进行适当的格式化

所提供的ChangeGear 5.0文档规定了如下结构请求:

POST /cgweb/cgwebservices/cgwebservices.asmx HTTP/1.1
Host: ...
Content-Type: application/soap+xml; charset=utf-8

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <Search xmlns="http://www.sunviewsoftware.com/CGWebServices/">
      <sessionId>string</sessionId>
      <entityType>string</entityType>
      <criteria>string</criteria>
      <retrieveRelated>boolean</retrieveRelated>
      <entityTemplate>string</entityTemplate>
    </Search>
  </soap12:Body>
</soap12:Envelope>
POST/cgweb/cgwebservices/cgwebservices.asmx HTTP/1.1
主持人:。。。
内容类型:应用程序/soap+xml;字符集=utf-8
一串
一串
一串
布尔值
一串
这是我使用指定标题发布的请求:

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <Search xmlns="http://www.sunviewsoftware.com/CGWebServices/">
      <sessionId></sessionId>
      <entityType></entityType>
      <criteria></criteria>
      <retrieveRelated>true</retrieveRelated>
      <entityTemplate></entityTemplate>
    </Search>
  </soap12:Body>
</soap12:Envelope>

真的
我设置的唯一参数是RetrieverRelated,因为它是唯一必需的参数,但我也尝试将所有字符串参数设置为任意非空值,并收到相同的结果。我确信API是功能性的,因为当我使用登录操作时,它会成功返回:

POST /cgweb/cgwebservices/cgwebservices.asmx HTTP/1.1
Host: ...
Content-Type: application/soap+xml; charset=utf-8

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <Login xmlns="http://www.sunviewsoftware.com/CGWebServices/">
      <userName>...</userName>
      <password>...</password>
    </Login>
  </soap12:Body>
</soap12:Envelope>
POST/cgweb/cgwebservices/cgwebservices.asmx HTTP/1.1
主持人:。。。
内容类型:应用程序/soap+xml;字符集=utf-8
...
...
结果:

200 OK
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <LoginResponse xmlns="http://www.sunviewsoftware.com/CGWebServices/">
      <LoginResult>...</LoginResult>
    </LoginResponse>
  </soap:Body>
</soap:Envelope>
200正常
...
我正在使用与登录操作相同的会话。除了为省略的参数添加空标记或将其名称大写外,我还可以尝试其他方法吗?完全错误是:

500 Internal Server Error
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <soap:Fault>
      <soap:Code>
        <soap:Value>soap:Receiver</soap:Value>
      </soap:Code>
      <soap:Reason>
        <soap:Text xml:lang="en">Object reference not set to an instance of an object.</soap:Text>
      </soap:Reason>
      <soap:Node>.../cgweb/cgwebservices/cgwebservices.asmx</soap:Node>
      <detail>
        <Error xmlns=".../cgweb/cgwebservices/cgwebservices.asmx">
          <ErrorNumber>0</ErrorNumber>
          <ErrorMessage/>
          <ErrorCode>L_REJECT_CHANGES_FAILED</ErrorCode>
        </Error>
        <Error xmlns=".../cgweb/cgwebservices/cgwebservices.asmx">
          <ErrorNumber>0</ErrorNumber>
          <ErrorMessage>Object reference not set to an instance of an object.</ErrorMessage>
          <ErrorCode>Object reference not set to an instance of an object.</ErrorCode>
        </Error>
        <Error xmlns=".../cgweb/cgwebservices/cgwebservices.asmx">
          <ErrorNumber>0</ErrorNumber>
          <ErrorMessage>Object reference not set to an instance of an object.</ErrorMessage>
          <ErrorCode/>
        </Error>
      </detail>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>
500内部服务器错误
肥皂:接收器
对象引用未设置为对象的实例。
…/cgweb/cgwebservices/cgwebservices.asmx
0
L\u拒绝\u更改\u失败
0
对象引用未设置为对象的实例。
对象引用未设置为对象的实例。
0
对象引用未设置为对象的实例。

问题在于服务器没有遵守WSDL。entityTemplate参数是必需的,如果没有该参数,服务器将返回“对象引用未设置为对象实例”错误。当我最初使用伪值测试参数时,出于巧合,我意外地忘记设置这个参数——唯一偏离WSDL规范的参数。

问题是服务器没有遵守WSDL。entityTemplate参数是必需的,如果没有该参数,服务器将返回“对象引用未设置为对象实例”错误。当我最初用伪值测试参数时,出于巧合,我意外地忘记设置这个参数——这是唯一偏离WSDL规范的参数