Я был разработчиком cf в течение 11 лет, но смущался, когда говорил, что ничего не сделал для веб-сервисов.
Как мне сформировать вызов cfhttp для использования следующего API веб-сервиса, предоставляемогопоставщик?
Мыло 1.2 Запрос:
POST /Portal/internet.asmx HTTP/1.1
Host: 192.168.222.240
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>
<Usage xmlns="http://portal/internet.asmx">
<SessionID>string</SessionID>
<CustomerCode>int</CustomerCode>
<FullUserName>string</FullUserName>
<StartDate>dateTime</StartDate>
<EndDate>dateTime</EndDate>
</Usage>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
Мыло 1.2 Ответ:
<?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>
<UsageResponse xmlns="http://portal/internet.asmx">
<UsageResult>
<xsd:schema>schema</xsd:schema>xml</UsageResult>
</UsageResponse>
</soap12:Body>
</soap12:Envelope>
Я хочу сделатьэто вручную на данный момент (я знаю о cfinvoke и createobject).Я нашел следующее из блога Бена Наделя, но получаю ошибку «сбой соединения».Я думаю, мне просто нужно, чтобы кто-то проверил очевидные недостатки в коде, прежде чем я выясню, действительно ли это связано с подключением / авторизацией.
<cfsavecontent variable="soapBody">
<cfoutput>
<?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>
<Usage xmlns="http://portal/internet.asmx">
<SessionID>F7B3B3FB-DE35-45CB-A785-8229E91FAEC9</SessionID>
<CustomerCode>1112221</CustomerCode>
<FullUserName>MR DAVE GEORGE</FullUserName>
<StartDate>2010-01-01</StartDate>
<EndDate>2009-01-01</EndDate>
</Usage>
</soap:Body>
</soap:Envelope>
</cfoutput>
</cfsavecontent>
<cfhttp
url="http://portal/internet.asmx"
method="post"
result="httpResponse">
<cfhttpparam
type="header"
name="SOAPAction"
value="http://portal/internet.asmx/Usage"
/>
<cfhttpparam
type="header"
name="accept-encoding"
value="no-compression"
/>
<cfhttpparam
type="xml"
value="#trim( soapBody )#"
/>
</cfhttp>
<cfoutput>
#httpResponse.fileContent# <!--- ouputs "connection failure" --->
</cfoutput>
Большое спасибо, Пол