Здравствуйте! Не первый день бьюсь над одной проблемой. Заключается она в следующем: Необходимо осуществить удаленный вызов веб-сервиса, код прилагается ниже: Код | @SchemaValidation() @WebService(name = "JournalWebService", serviceName = "JournalWebService", targetNamespace = NamespaceConstants.JOURNAL_NS) @HandlerChain(file = "SessionHandler.xml") public class JournalWebService extends SpringBeanAutowiringSupport {
Log logger = LogFactory.getLog(this.getClass());
@Autowired private DispatchService dispatchService;
@WebMethod(operationName = "GetIncidentJournal", action = "GetIncidentJournalAction") @RequestWrapper(className = "com.icl.ios.edds.dispatch.journal.ws.IncidentJournalRequest", targetNamespace = NamespaceConstants.JOURNAL_NS) @ResponseWrapper(className = "com.icl.ios.edds.dispatch.journal.ws.IncidentJournalResponse", targetNamespace = NamespaceConstants.JOURNAL_NS) @Deprecated public List<IncidentJournalRow> getIncidentJournal() { StopWatch stopWatch = new StopWatch(); try { stopWatch.start(); List<com.icl.ios.edds.dispatch.journal.model.IncidentJournalRow> list = dispatchService.getIncidentJournalRows();
List<IncidentJournalRow> result = new ArrayList<IncidentJournalRow>();
for (com.icl.ios.edds.dispatch.journal.model.IncidentJournalRow element : list) {
IncidentJournalRow incidentJournalRow = createWSIncidentJournalRow(element);
result.add(incidentJournalRow); }
return result; } finally { logger.info("method: getIncidentJournal() time:" + stopWatch.toString()); stopWatch.stop(); } } }
|
Написал клиент по аналогии с этим примером: http://technology.amis.nl/2011/06/29/how-t...ervice-library/Предварительно поймал сниффером удачное обращение к методу веб-сервиса (из интерфейса другой программы): Код | <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Header> <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" S:mustUnderstand="1"> <xenc:EncryptedKey xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Id="XWSSGID-1361856561728-1108975542"> <xenc:EncryptionMethod xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/> <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <wsse:SecurityTokenReference xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <wsse:KeyIdentifier EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier"> G/rY0s6wplJKB0QI4FXPhlNDLDI= </wsse:KeyIdentifier> </wsse:SecurityTokenReference> </ds:KeyInfo> <xenc:CipherData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"> <xenc:CipherValue xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"> [truncated] jYnP5aBj4QK2vKS3G+VfOLNt9a7+yD++WLUe4wJjVa0uFAiqzt09xvKmGiyAqX8HdJcvEdWuxh8H\nHFPhwUnjNnuhLjDq7Q9s1UhNULrTXOoXjJCJNhVLSNdHh9aY4gj8Bh+FI+4C18DiBDNhkv9SUKhu\nBoxGF2C91HoHm5lfBtorQILUu1XzMQOQu9wDXkmejK3GbT5k8tu/Pjp0gH3GmxYxlKR9VqG </xenc:CipherValue> </xenc:CipherData> </xenc:EncryptedKey> <xenc:ReferenceList xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"> <xenc:DataReference URI="#XWSSGID-1361856561728-880401247"/> </xenc:ReferenceList> <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="XWSSGID-13617909146842136269615"> <ds:SignedInfo> <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> <InclusiveNamespaces xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="wsse S"/> </ds:CanonicalizationMethod> <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> <ds:Reference URI="#XWSSGID-1361856561728-40221937"> <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/> <ds:DigestValue> 3QoMOhFkck2b+iiBco7ny2nKMNg= </ds:DigestValue> </ds:Reference> </ds:SignedInfo> <ds:SignatureValue> SVR7j7YQwODWw7tgSX8RzD4wnQi3mKZZYsPeBKGcLgOgPDREjIvFp9HC3z9mBg4FRwzH/9p4asQs\nQLPrTHjrtQ== </ds:SignatureValue> <ds:KeyInfo> <wsse:SecurityTokenReference xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="XWSSGID-13618565617281127366461"> <wsse:KeyIdentifier EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier"> RZLm0GvPA91eadj1ayZy0tVUU2E= </wsse:KeyIdentifier> </wsse:SecurityTokenReference> </ds:KeyInfo> </ds:Signature> </wsse:Security> </S:Header> <S:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="XWSSGID-1361856561728-40221937"> <xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Id="XWSSGID-1361856561728-880401247" Type="http://www.w3.org/2001/04/xmlenc#Content"> <xenc:EncryptionMethod xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/> <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <wsse:SecurityTokenReference xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <wsse:Reference URI="#XWSSGID-1361856561728-1108975542"/> </wsse:SecurityTokenReference> </ds:KeyInfo> <xenc:CipherData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"> <xenc:CipherValue xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"> [truncated] o6XzruRnRzNE5G5vqaBx5VTK4f1wPQVDPM7GkLzIaT8mNDzflF+TXIGDws34W0nRPg8mJmwdjXSz\npXXdmoS0KMjBR1N3Uzpt4V5Vx52E7Q1QujwW/Pn2Ek1YbyGSMJYOltZ2IieLYIYfKkogryAhLc7k\n6QvYRwL4QCSRpPLdm/k7zVcGSbYlX/6kN/YvDDU0QkILjtwaMxvWGGJrasntlm+H/bJVRCv </xenc:CipherValue> </xenc:CipherData> </xenc:EncryptedData> </S:Body> </S:Envelope>
|
Как видно, на другой стороне используется цифровая подпись и шифрование. Пробовал отсылать в теле запроса аналогичную xml, но получал ошибку: com.sun.xml.wss.XWSSecurityException: com.sun.xml.wss.impl.WssSoapFaultException: com.sun.org.apache.xml.internal.security.exceptions.Base64DecodingException: It should be divisible by four В Java я совсем новичок и представления не имею, как решить эту задачу. В качестве IDE использую IDEA 11.1, App server - JBoss 7.1.1
|