클라이언트 측 SOAPHandler를 작성하여 서버 &으로 나가는 요청을 로깅하려면 JAX-WS를 사용하여 일부 요소를 수정하십시오.SOAPHandler의 saveChanges 이후 SOAP 메시지가 변경됨
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="xmldsig-4cf24b6d-5c1a-4756-9657-3ba87c3af164">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
I :이 인쇄 된 메시지의 일부이다
ByteArrayOutputStream baos = new ByteArrayOutputStream();
msg.writeTo(baos);
System.out.println(baos.toString(getMessageEncoding(msg)));
:
try {
// modifying elements
SOAPBody body = soapMsg.getSOAPBody();
NodeList blst = body.getElementsByTagName("ns6:exportNsiItemRequest");
Node itm = blst.item(0);
Node itm2 = itm.getFirstChild();
Document doc = body.getOwnerDocument();
doc.adoptNode(nd);
itm.insertBefore(nd, itm2);
soapMsg.saveChanges();
log.info("XML saved!");
} catch (SOAPException e1) {
log.info("XML DOESN'T saved!");
e1.printStackTrace();
}
다음 I 메시지를 인쇄 : I 요소를 변형 한 후
는 I 메시지를 저장할 서버로가는 실제 비누 메시지의 컨텍스트를 보려면 Wireshark를 사용하십시오.
그리고 내가 보는 무엇입니까 ?? 그것은 :
<ds:Signature
xmlns=""
Id="xmldsig-4cf24b6d-5c1a-4756-9657-3ba87c3af164"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod
Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
내 메시지를 수정하고 xlnms = ""태그를 삽입하는 이유는 무엇입니까?
답변을 찾았습니까? 나는 여기에 같은 문제가있다 ... –
아니, 아직 못 찾았 어. 찾았 으면 나와 공유하십시오 – Lev
질문에 관련된 모든 코드를 추가 할 수 있습니까? (메시지를 수정하는 방법과 메시지를 서버로 보내는 방법). 이것은 당신을 도울 수있는 더 나은 상황을 줄 것입니다. 나는 당신이 SOAP 요청을 보낼 때 SOAPSender 나 이름이 무엇이든 자동으로 빈'xmlns' 태그를 추가 할 것이라고 생각합니다. 원래의 메시지는 그것을 포함하지 않기 때문에 필요할 수 있습니다. – DarkCygnus