Web services ColdFusion soap客户端

Web services ColdFusion soap客户端,web-services,coldfusion,wsdl,Web Services,Coldfusion,Wsdl,下面是SOAP1.2请求和响应示例。显示的占位符需要替换为实际值 POST /CommunicationOfficeService1_0/CompanyAccountXmlService.asmx HTTP/1.1 Host: webservices.nbs.rs Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?>

下面是SOAP1.2请求和响应示例。显示的占位符需要替换为实际值

POST /CommunicationOfficeService1_0/CompanyAccountXmlService.asmx HTTP/1.1
Host: webservices.nbs.rs
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?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:Header>
    <AuthenticationHeader xmlns="http://communicationoffice.nbs.rs">
      <UserName>string</UserName>
      <Password>string</Password>
      <LicenceID>guid</LicenceID>
    </AuthenticationHeader>
  </soap12:Header>
  <soap12:Body>
    <GetCompanyAccountByNationalIdentificationNumber xmlns="http://communicationoffice.nbs.rs">
      <nationalIdentificationNumber>long</nationalIdentificationNumber>
    </GetCompanyAccountByNationalIdentificationNumber>
  </soap12:Body>
</soap12:Envelope>

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?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>
    <GetCompanyAccountByNationalIdentificationNumberResponse xmlns="http://communicationoffice.nbs.rs">
      <GetCompanyAccountByNationalIdentificationNumberResult>string</GetCompanyAccountByNationalIdentificationNumberResult>
    </GetCompanyAccountByNationalIdentificationNumberResponse>
  </soap12:Body>
</soap12:Envelope>
POST/communicationofficeservice 1\u 0/CompanyAccountXmlService.asmx HTTP/1.1
主持人:webservices.nbs.rs
内容类型:应用程序/soap+xml;字符集=utf-8
内容长度:长度


如何使此web服务运行

我修改了一个函数,该函数过去用于通过soap将数据从ColdFusion传递给Dynamics GP

<cffunction name="callWebService" access="public" output="false">
    <cfargument name="soap" type="xml" required="true">
    <cfhttp url="https://webservices.nbs.rs/CommunicationOfficeService1_0/CompanyAccountXmlService.asmx"  method="post">
        <cfhttpparam type="header" name="content-type" value="application/soap+xml">
        <cfhttpparam type="header" name="SOAPAction" value="http://communicationoffice.nbs.rs/GetCompanyAccountByNationalIdentificationNumber">
        <cfhttpparam type="header" name="accept-encoding" value="no-compression">
        <cfhttpparam type="header" name="content-length" value="#len(Arguments.soap)#">
        <cfhttpparam type="header" name="charset" value="utf-8">
        <cfhttpparam type="xml" name="message" value="#trim(Arguments.soap)#">
    </cfhttp>
    <cfreturn Trim(cfhttp.FileContent)>
</cffunction>

我相信我已经更新了您链接的web服务所需的
s
。我建议使用一个名为soapui的软件来测试您与ColdFusion之外的服务和soapxml主体的连接。在我上面的函数中,参数soap将是您保存的内容“soapBody”

有一件事需要在你的身体里解决。XML开头之前的文本是关于需要在HTTP头中的数据的信息,我只看到这些值被插补为

我认为,使用上述代码可能无法获得所需的200响应的原因是,XML正文的格式与WSDL HTTP头示例文本的格式不正确。我也没有看到身体的长度也被宣布


在尝试设置连接时,请尝试将
httpResponse
转储出去,直到您开始看到来自服务器的有效soap响应。

您没有收到任何结果或错误?如果您没有收到错误,您可能连接成功。我没有收到任何结果,奇怪的是,这个web服务很容易从c sharp和php使用,但是java-无法使用netbeans向导生成所有正确的类,而cold fusion没有给我任何回报。网站和web服务是用asp技术制作的。也许我遗漏了什么…如果你没有得到结果,那么你发送了错误的标准。如果它无法连接,您应该会得到一个单独的错误。所有参数都正常-用户名、密码和许可证ID。可能是在cfhttpparam的代码中我做错了什么!?谢谢,我会试试的!
<cffunction name="callWebService" access="public" output="false">
    <cfargument name="soap" type="xml" required="true">
    <cfhttp url="https://webservices.nbs.rs/CommunicationOfficeService1_0/CompanyAccountXmlService.asmx"  method="post">
        <cfhttpparam type="header" name="content-type" value="application/soap+xml">
        <cfhttpparam type="header" name="SOAPAction" value="http://communicationoffice.nbs.rs/GetCompanyAccountByNationalIdentificationNumber">
        <cfhttpparam type="header" name="accept-encoding" value="no-compression">
        <cfhttpparam type="header" name="content-length" value="#len(Arguments.soap)#">
        <cfhttpparam type="header" name="charset" value="utf-8">
        <cfhttpparam type="xml" name="message" value="#trim(Arguments.soap)#">
    </cfhttp>
    <cfreturn Trim(cfhttp.FileContent)>
</cffunction>