2012-06-21 2 views
3

나는 이것을 알아 내지 못했기 때문에 기분이 상쾌합니다. 나는 파트너로부터 정보를 받아들이는 coldfusion webservice (bluedragon7)를 가지고있다. 그들은 결과 필드에 xml을 전달하고 있으며 인수에 accessionNumber의 첫 번째 요소 만 표시합니다. 인수 유형을 다른 것 (any, string 등)으로 변경하면 500 개의 오류가 발생합니다. 내가 여기서 뭔가를 놓치고 있니?Coldfusion Webservice 수신 객체

다음
<cffunction access="remote" name="result" output="false" returntype="any" hint=""> 
<cfargument name="userid" type="string" required="yes" hint="userid"> 
<cfargument name="password" type="string" required="yes" hint="password"> 
<cfargument name="result" type="xml" required="Yes" default="result"> 
</cffunction> 

자신의 게시물의 샘플입니다 :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
<soapenv:Header /> 
<soapenv:Body> 
    <result xmlns="http://cws.ots.labcorp.com"> 
     <userId>peter265974</userId> 
     <password>pwd265974</password> 
     <result> 
      <accessionNumber>0572854881</accessionNumber> 
      <accountLocationCode>000010</accountLocationCode> 
      <accountLocationName>AERO CONTROL</accountLocationName> 
      <accountLocationPhone>2537353350</accountLocationPhone> 
      <accountName>HEALTHFORCE PARTNERS CORPORATE</accountName> 
      <accountNumber>000804</accountNumber> 
      <collectorCOCcomments> 
       <abbreviation /> 
       <commentText>100154550. TEST OF VIEWING CO</commentText> 
       <commentType>MS</commentType> 
      </collectorCOCcomments> 
     </result> 
    </result> 
</soapenv:Body> 

+0

: 대신에 "몸 SOAP-ENV"의 "몸 soapenv을"

하지만 당신은 단지 삽입 몸의 내용이 VAR

<cfset var body = xmlsearch(cont, "//SOAP-ENV:Body")[1] /> 

에 저장됩니다 라인을 변경해야 결과를 XML 변수로 정의하는 대신 XML 구조와 일치하도록 CFC를 모델링해야한다고 생각합니다. 복잡한 객체를 사용하는 방법에 대해서는 CF 가이드를 따르거나 가능한 경우 SOAP 대신 간단한 JSON 웹 서비스로 전환하십시오. :) – Henry

+0

Henry, 게시하지 않고 불행히도 이러한 유형의 처리에 대한 정보를 찾을 수 없었습니다. 제공 할 수있는 참조 또는 추가 정보가 있습니까? 감사! – user1473443

+0

XML은 항상 ** 하나 ** 루트 요소가 필요하다고 생각합니다. 그래서' ...'또는 그와 비슷한 것으로 둘러싸인 결과 (accessionNumber, accountLocationCode, ...)를 전달해보십시오. – Seybsen

답변

0

난 그냥 같은 문제가 있었다 여기

함수의 조각입니다. 요소가 여전히 "xmlchild"를 가지고 있는지 확인하면서 모든 요소를 ​​반복하려고했습니다. 어쩌면 내 thread 여기에서 도울 수 있습니다.

관련 문제