jQuery Ajax를 사용하여 asmx 서비스를 호출하려고합니다.jQuery Ajax를 사용하여 비누 봉투의 사용자 정의 헤더 보내기
POST /YderWS.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://scandihealth.com/iwebservices/HentKommuner"
<?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:Header>
<AuthHeader xmlns="http://scandihealth.com/iwebservices/">
<PartnerID>string</PartnerID>
<SubPartnerID>string</SubPartnerID>
<SubPartnerType>string</SubPartnerType>
</AuthHeader>
</soap:Header>
<soap:Body>
<HentKommuner xmlns="http://scandihealth.com/iwebservices/" />
</soap:Body>
</soap:Envelope>
위의 내용은 서비스에 보내는 SOAP 1.1 요청입니다. 아래의 호출을 사용하여 사용자 정의 비누 헤더를 설정합니다. 하지만 내 요청은 실패합니다. 아무도 나를 위해 아래 코드를 디버그하고 내가 뭘 해야할지 알려주 수 있습니까?
var authHeader = "<PartnerID>SCTEST001</PartnerID> <SubPartnerID>001</SubPartnerID> <SubPartnerType>S</SubPartnerType>";
//Call the page method
$.ajax({
type: "GET",
url: servicename + "/" + functionName,
beforeSend: function (xhr) {
xhr.setRequestHeader('AuthHeader', authHeader);
},
success: successFn,
error: errorFn
});
편집 * 추가 정보가이 질문에 대답 할 필요가 있으면 알려 주시기 바랍니다. *
오류의 원인은 무엇입니까? 그것은 쉽게 크로스 도메인 문제가 될 수 있습니다. –