라고하지 않을 때 실패하지만 내가 만든 후 내가 전화하면 내가 그것을 생략 할 때 내는 SOAPMessage
의 서비스 호출이 성공적으로 완료 SOAPMessage.writeTo(out)
하지만 실패합니다.SOAP 서비스 호출은 SOAPMessage.writeTo가 나는 <strong>SOAP</strong> 서비스를 호출하려고
저는 전화를 걸기 전에 반드시 writeTo()
이 필수 단계가 아니며 잘못된 것을하고 있다고 확신합니다.
아이디어가 있으십니까? 여기
은 세부 사항입니다내 고객
public class Test {
public static void main(String args[]) throws Exception {
// Create SOAP Connection
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
// Send SOAP Message to SOAP Server
String url = "https://mydomain.com/webservices/gateway/IdMgt/CorporateDirectoryLookupPort";
SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(), url);
// print SOAP Response
soapResponse.writeTo(System.out);
soapConnection.close();
}
private static SOAPMessage createSOAPRequest() throws Exception {
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
+ "<soapenv:Header>"
+ "<ns1:Security soapenv:mustUnderstand=\"0\" xmlns:ns1=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">"
+ "<ns1:UsernameToken>"
+ "<ns1:Username></ns1:Username>"
+ "<ns1:Password></ns1:Password>"
+ "</ns1:UsernameToken>"
+ "</ns1:Security>"
+ "</soapenv:Header>"
+ "<soapenv:Body>"
+ "<GetAccountDetailsRequest2 xmlns=\"http://anotherdomain/schema/tCorporateDirectoryLookupV1\">"
+ "<MessageHeader xmlns=\"\"/><UserID xmlns=\"\"></UserID>"
+ "<AccountID xmlns=\"\">ServiceDeskAPIprd</AccountID>"
+ "</GetAccountDetailsRequest2></soapenv:Body>"
+ "</soapenv:Envelope>";
InputStream is = new ByteArrayInputStream(xml.getBytes());
SOAPMessage soapMessage = MessageFactory.newInstance().createMessage(
null, is);
/* Print the request message */
soapMessage.writeTo(System.out);
System.out.println();
return soapMessage;
}
}
createSOAPRequest
에서 soapMessage.writeTo(System.out)
가 내가 유효한 응답을 주석 처리하지이지만이 주석 때 나는
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode>
<faultstring>no SOAPAction header!</faultstring>
<detail>
<ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">lxvirt150</ns2:hostname>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
나는 아주 똑같은 문제에 직면 해있다. 나는 "messageByteCount"SoapMessage의 필드가 writeTo 메소드 (나의 경우 0에서 524까지)를 호출 한 후에 업데이트되었다는 것을 알아 차렸다. writeTo 메서드를 실행하는 동안 saveMessage 메서드가 호출 된 것을 알았 기 때문에 MessageFactory를 호출 한 직후에 writeTo를 호출하는 대신 해당 메서드를 시도했지만 실제로는 사용하지 않았습니다. 알아 냈어? –