Trying to parse a Soap Message
I'm working on creating webservices that will be consumed by
Director and working with the client programmer, we've come to
recognize the problem, but we don't know how to resolve it.
Problem: the XMLParser doesn't follow href parameters in tags
that refer to subobjects, which result in a #getProp Ref error.
I have a web service method that will return a list of names
and it returns the following XML response:
<?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>
<getStudentsResponse soapenv:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/">
<getStudentsReturn href="#id0"
/>
</getStudentsResponse>
<multiRef id="id0"
soapenc:root="0" soapenv:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"
soapenc:arrayType="xsd:anyType[6]"
xsi:type="soapenc:Array" xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/">
<multiRef
xsi:type="soapenc:string">Bob B
Bobbly</multiRef>
<multiRef
xsi:type="soapenc:string">Andy A
Anderson</multiRef>
<multiRef
xsi:type="soapenc:string">Carl C
Carlson</multiRef>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>
When it hits the getStudentsReturn element and tries to refer
to a child node, and obviously fails.
The server is Tomcat 5.5, using Axis 1.4 for web services. I
can post a wsdl if desired.
The web service is configured for rpc/encoded style.
What is the way to get out of this particular jam? Neither me
nor the client programmer have extensive knowledge of how Director
(or the relevant Xtra) handles SOAP messages or parse them. I've
stepped through the code and seen the XML parser object render the
response into an object tree, but it doesn't respect the href's.
I can provide follow up to any questions or comments about
this problem.
Regards,
Jeff Vandenberg
Hi Jeff,
While I don't have much experience with web services, I'm
about to
embark on something that involves extensive use of them, so
your post
caught my eye.
If I understand correctly, the href attribute associated with
the
getStudentsReturn node is supposed to "automatically" link to
the
following multiRef array. Is that correct?
Assuming it *did* link correctly, how would this manifest
itself? Is it
not a matter of you the parser watching for href tags and
resolving them
yourself? Why would you not simply provide the multiRef nodes
as
children of the getStudentsReturn node? Is there
documentation somewhere
for the href attribute and this form of linking?
Have you tried using the Flash Asset xtra for parsing, and
does it
behave "correctly"?
Similar Messages
-
Receiving and parsing a SOAP Message
Hi All.
I have just installed the JAXM package, cause I want to programm a network message broker using SOAP. The server code is written in C# and I tested it. All messages are send and processed via SOAP and it all works.
So I now want to try to receive these messages with a JAVA program. But when I looked up the API I didnt find any class or method for only receiving SOAP messages. I guess that I have overlooked the part where this is explained, or I got something wrong. But I would be grateful, if anyonle could tell me if and how this will work.
Thanx in advance,
ChristianHi
To get a service to only receive messages you must use a class that implements Onewaylistener, and this class must be supported in a container environment e.g. servlet or J2EE container. It defines one method, public SOAPMessage onMessage(SOAPMessage) which is called by the container when it receives a message. For example say I want to create a servlet that receives SOAP messages for a purchasing application
public class PurchasingServlet extends JAXMServlet implements
OnewayListener{
public SOAPMessage onMessage(SOAPMessage message){}
The JAXMServlet is a helper servlet to handle SOAP messages but it is not necessary to implement.
Hope this helps. -
some help is required on the SOAP processing
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<getPricedAvailability xmlns="http://www.openuri.org/" xmlns:tget="http://www.ba.com/schema/tGetPricedAvailabilityV1">
<tget:GetPricedAvailabilityRequest>
<Name>ian</Name>
....i need to add a tag name[in between the two tags] <asl>US </asl>
<age>1234</age>
</tget:GetPricedAvailabilityRequest>
</getPricedAvailability>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope
Can any one suggest or send me the piece of code which does this..
i tried to add the tag by using the below code but in vain it didn't happen ...it is not adding in between the 2 tags.
it is adding after <age>.... Can any one help me in this...Is there is any other way of parsing the SOAP message is possible
SOAPMessageContext smc = (SOAPMessageContext)mc;
SOAPMessage sm = smc.getMessage();
SOAPEnvelope env = sm.getSOAPPart().getEnvelope();
SOAPBody body = env.getBody();
javax.xml.soap.Name sName;
System.out.println(" Entering callEndTag #########################################");
System.out.println("body"+body +" "+"env"+env);
if ( body != null ){
java.util.Iterator childElems = body.getChildElements();
SOAPElement child;
int i=0;
// iterate through child elements
while (childElems.hasNext())
System.out.println("childElems" +childElems);
Object elem = childElems.next();
System.out.println("elem" +elem);
if(elem instanceof SOAPElement )
// get child element and its name
child = (SOAPElement) elem;
sName = child.getElementName();
if (sName.getLocalName().equals("getPricedAvailability"))
childElems = child.getChildElements();
while (childElems.hasNext())
// get next child element
elem = childElems.next();
if(elem instanceof SOAPElement )
child = (SOAPElement) elem;
sName = child.getElementName();
if (sName.getLocalName().equals("GetPricedAvailabilityRequest"))
{childElems = child.getChildElements();
sName = child.getElementName();
System.out.println("SNAME inSIDE IF LOOP" +sName);
System.out.println("If Elem is a) instance ====After");
if (childElems.hasNext())
// get next child element
elem = childElems.next();
System.out.println("If Elem is a) instance == before");
if(elem instanceof SOAPElement )
System.out.println("If Elem is a) instance ====After");
System.out.println("before type cast" );
child = (SOAPElement) elem;
sName = child.getElementName();
System.out.println("Start adding process added end date" +sName);
SOAPElement fResponse12 = child.addChildElement(env.createName("EndDate-- ==child "));
fResponse12.addAttribute(env.createName("xmlns"),
fResponse12.addTextNode(strEndDate );
((SOAPMessageContext)mc).setMessage(sm);Hi Experts,
I'm trying to protect a web service deployed in jcaps 5.1.1, using SAML assertions against an Access Manager 7/7.1, the web services clients are both, web and standalone applications, I also have read netbeans tutorials, that expose how to implement identity webservices using AppServer 9.1 + AccessManager 7.1 using the SAML Holder of key and other security mechanisms, but this implementation requiere modifications to the server.policy file to add support to SOAP message security providers and HttpServlet message security providers, the addition of a library called amwebservicesprovider.jar to the classpath suffix (this library implements the jsr-196 java Authentication Service Provider Interface for Containers) and aditional configuration required in the AM side that is not detailed in the tutorials.
Could someone guide me on how to protect the acces to a web services deployed in the jcaps logicalhost based on AM roles assigned to users?
Any help is aprecciated
Juan -
How To : Call External Webservice from BPEL and pass SOAP Message to the WS
Hello All-
Greetings to all BPEL gurus. I am currently facing difficulties in calling an External Webservice from my BPEL Process and passing SOAP Message to it. The details are below:
<strong>1. The BPEL process, using database polling feature of DB Adapter, will get the records from the database.</strong>
<strong>2. Transform the message</strong>
<strong>3. Call the External Webservice and pass the transformed message as the input to it. However the Webservice expects the BPEL process to send SOAP headers in the input message.</strong>
I am struggling on how to put the transformed message within a SOAP envelope in the BPEL process.
If anyone had similar requirements and have successfully been able to send SOAP messages from BPEL process to an external webservice, kindly let me know.
Also if there is some kind of documentation or any link in the forum that I can refer, please let me know that as well.
I am new to Webservice integration using BPEL and would really appreciate your help.
Thanks In Advance
Regards,
DibyaHi Dharmendra,
I am trying to send a SOAP message from my BPEL process to a web service. I have a complete SOAP message in a complex variable defined in the wsdl for the partnerlink (web service). My problem is that when I invoke the partnerlink it fails even though the content shown in the BPEL console looks valid.
I have set up obtunnel to see what I am actually sending out from BPEL. You mention that BPEL creates the SOAP envelope automatically.
I think that my problem is a result of this automatic SOAP envelope that BPEL is creating. Do you know if there is a way to turn it off?
This is what I see in the TCP monitor, please note the double SOAP env:Body:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> <RCMR_IN000002NR01 xmlns="urn:hl7-org:v3" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<env:Header>
<wsa:To xmlns:wsa="http://www.w3.org/2005/08/addressing">http://testhost/CCS/Service_Endpoint</wsa:To>
<wsa:From xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Address>http://localhost/CCS/Service_Endpoint</wsa:Address>
<wsa:Metadata>
<device xmlns:hl7="urn:hl7-org:v3">
</device>
</wsa:Metadata>
</env:Header>
<env:Body>
<RCMR_IN000002NR01>
</RCMR_IN000002NR01>
</env:Body>
</RCMR_IN000002NR01>
</env:Body>
</env:Envelope>
Any help is appreciated.
Regards,
Aagaard
Edited by: Aagaard on Oct 30, 2008 8:59 PM
Should have mentioned. I am using BPEL 10.1.3.4
Edited by: Aagaard on Oct 31, 2008 8:43 AM
I have opened a new thread for this question so as to not confuse the issue more than necessary.
How many SOAP envelopes do you really need? -
Error while posting SOAP message
I am trying to post a SOAP message but I keep getting this error. Can anybody help me on this. I tried using ALTOVA spy and SOAP Ui but the result is the same error.
<SOAP:Body>
<SOAP:Fault>
<faultcode>SOAP:Server</faultcode>
<faultstring>Server Error</faultstring>
<detail>
<s:SystemError xmlns:s="http://sap.com/xi/WebService/xi2.0">
<context>XIAdapter</context>
<code>ADAPTER.JAVA_EXCEPTION</code>
<text><![CDATA[
com.sap.aii.af.service.cpa.CPAObjectNotFoundException: Couldn't retrieve binding for the given channelId: Binding:CID=null;
* at com.sap.aii.af.service.cpa.impl.lookup.AbstractLookupManager.getBindingByChannelId*(AbstractLookupManager.java:173)
at com.sap.aii.adapter.soap.web.MessageServlet.doPost(MessageServlet.java:431)
Scenario is SOAP Sender and IDOC reciever.I tried reconfiguring also.
When I test from Integration Engine in RWB using the test message it is sucsseful. Infact I can see the IDOC too.
But when the basis guy tested with Adapter engine in RWB using the test tool, it gives the following error:
Error While Sending Message: Additional error text from response: com.sap.engine.interfaces.messaging.api.exception.ConfigException: ConfigException in XI protocol handler. Failed to determine a receiver agreement for the given message. Root cause: com.sap.aii.af.service.cpa.CPAObjectNotFoundException: Couldn't retrieve outbound binding for the given P/S/A values: FP=;TP=;FS=BusComp_Siebel1;TS=;AN=SI_Sales_Order_OB_Async;ANS=http://trm.com:o2b:SalesOrderCreate; in the current context [Unknown].
Any idea where is the problem.
When we tried the WSN step we are facing this error in the very first step.
WSDL1.1, WSDL 2.0 definition element expected. Found [html: null] .
Edited by: Chandra Gunapati on Oct 7, 2009 10:00 PM -
Mixed encoding in soap message reply
I am trying to send a soap message to a service that uses UTF-16 encoding. I sent a UTF-8 encoded request. The reply was UTF-8 but the body was UTF-16.
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<SOAPSDK1:GetCountryStateAreaResponse xmlns:SOAPSDK1="http://tempuri.org/message/">
<Result xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAPSDK3="http://www.w3.org/2001/XMLSchema" SOAPSDK2:type="SOAPSDK3:string"><?xml version="1.0" encoding="UTF-16" ?><atdw_data_results><country id="500001" code="AU" name="Australia" isd_code="61" states_allowed_flag="1" product_id="503928"><state id="500006" code="TAS" name="Tasmania"><area id="500361" code="NNE">North - North East</area><area id="500362" code="NW">North West</area><area id="500363" code="S">South</area></state></country></atdw_data_results></Result>
</SOAPSDK1:GetCountryStateAreaResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I used an xslt transform to indent the xml but it could only understand the UTF-8 soap envelope.
Should I encode the request in UTF-16 and how can this be done in SAAJ ?
Should I try Apache Soap instead ? It seems very difficult to extract the body of the message using SAAJ.
Thanks
BillI have got it to work with Apache Soap. Much simpler to extract the reply body from the soap message too.
Bill -
Serialization of SOAP message in WL 7.1 (without toString)
Hi all.
I'm using Weblogic 7.1 and am trying to serialize the SOAP message I get in my
request handler to raw XML. Unfortunately since WL 7.1 only seems to support an
old version of SAAJ, that for some bizarre reason doesn't use the DOM interfaces,
the only way I can think of to do this is to call toString() on the message. Of
course I'd rather not do this since this is making assumptions about the WL implementation
of SAAJ. Can anyone think of a better way of doing this?
Since all I'm after is the raw XML anyway, would it make sense to just pass this
in as a string in the RPC call (given that my messages are likely to be fairly
big -- around 500K of raw XML)? Obviously this is a total hack, and I probably
won't end up doing it, but does anyone know of any good technical reasons why
I shouldn't do this?
Thanks.
Neil.Hi Neil
Manoj has an WLS 7.x example passing XML without data bindings [1] that
may assist your efforts. Also see the example using handlers to get the
SOAP request/response message.
Regards,
Bruce
[1]
http://manojc.com/?wls70/sample2
[2]
http://manojc.com/?wls70/sample4
Neil wrote:
>
Hi all.
I'm using Weblogic 7.1 and am trying to serialize the SOAP message I get in my
request handler to raw XML. Unfortunately since WL 7.1 only seems to support an
old version of SAAJ, that for some bizarre reason doesn't use the DOM interfaces,
the only way I can think of to do this is to call toString() on the message. Of
course I'd rather not do this since this is making assumptions about the WL implementation
of SAAJ. Can anyone think of a better way of doing this?
Since all I'm after is the raw XML anyway, would it make sense to just pass this
in as a string in the RPC call (given that my messages are likely to be fairly
big -- around 500K of raw XML)? Obviously this is a total hack, and I probably
won't end up doing it, but does anyone know of any good technical reasons why
I shouldn't do this?
Thanks.
Neil. -
Signing a soap message seems to not work in jwsdp14
I'm trying to sign a soap message according to the latest oasis specifications (http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0.pdf) using the libraries provided with jwsdp14 (mainly xmlsec.jar).
As far as I know, there is not yet documention/example about this specific issue.
The following is the code I have to sign a soap message: it seems to work fine because the signed soap message respects the above specifications... but what I notice is that the digest and the signature values it contains are always the same, I mean: if i change the source soap message, the signed soap message in output is always the same!
Any clue??
import com.sun.org.apache.xml.security.Init;
import com.sun.org.apache.xml.security.signature.XMLSignature;
import com.sun.org.apache.xml.security.transforms.Transforms;
import com.sun.org.apache.xml.security.utils.Constants;
import com.sun.xml.wss.*;
import com.sun.xml.wss.reference.DirectReference;
import org.w3c.dom.Document;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPBody;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
public class Main {
public static void main(String[] args) {
// The file from which we will load the sample SOAP message
String fileName = "F:\\SampleSoapMessage.xml";
// Store the WSSE signed message here
String signatureFileName = "F:\\SignedSampleSoapMessage.xml";
try {
// Initialize the apache libraries
Init.init();
// Obtain security elements from the keystore
PrivateKey privateKey = MySecurityUtils.getPrivateKey();
X509Certificate cert = MySecurityUtils.getCertificate();
// Obtain a sample SOAPMessage from a file
FileInputStream fis = new FileInputStream(new File(fileName));
Document doc = XMLUtil.toDOMDocument(fis);
SOAPMessage message = MyFileUtils.getMessageFromFile(doc);
SOAPHeader header = message.getSOAPHeader();
SOAPBody body = message.getSOAPBody();
// Set the wsu:Id attribute to the Body
XMLUtil.setWsuIdAttr(body, "MyId");
// Create a WSSE context for the SOAP message
SecurableSoapMessage sssm = new SecurableSoapMessage(message);
// Create a security header for the message (<wsse:Security>)
SecurityHeader sh = sssm.findOrCreateSecurityHeader();
// Insert the certificate (<wsse:BinarySecurityToken>)
X509SecurityToken stoken = new X509SecurityToken(header.getOwnerDocument(), cert, "X509TokenRef");
sh.insertHeaderBlock(stoken);
// Insert the keyinfo referring to the certificate (<ds:KeyInfo>)
KeyInfoHeaderBlock kihb = new KeyInfoHeaderBlock(header.getOwnerDocument());
SecurityTokenReference secTR = new SecurityTokenReference(header.getOwnerDocument());
DirectReference dirRef = new DirectReference();
dirRef.setURI("#X509TokenRef");
secTR.setReference(dirRef);
kihb.addSecurityTokenReference(secTR);
//sh.insertHeaderBlock(kihb);
// Insert the Signature block (<ds:Signature>)
SignatureHeaderBlock shb = new SignatureHeaderBlock(header.getOwnerDocument(), XMLSignature.ALGO_ID_SIGNATURE_RSA);
Transforms transforms = new Transforms(header.getOwnerDocument());
transforms.addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
shb.addSignedInfoReference("#MyId", transforms, Constants.ALGO_ID_DIGEST_SHA1);
shb.addChildElement(kihb.getAsSoapElement());
sh.insertHeaderBlock(shb);
// Digest all References (#MyId) in the SignedInfo, calculate the signature value
// and set it in the SignatureValue Element
shb.sign(privateKey);
// Add the signature data to the header element
header.addChildElement(sh.getAsSoapElement());
// Save the signed SOAP message
FileOutputStream fos = new FileOutputStream(new File(signatureFileName));
message.writeTo(fos);
message.writeTo(System.out);
} catch (Exception exc) {
exc.printStackTrace();
System.out.println("An error has occurred : " + exc.toString());
PS: Classes MySecurityUtils and MyFileUtils are not included since they have nothing interesting.
The sample input sopa message is:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<Intestazione>
</Intestazione>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
and the output signed sample message is:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#MyId">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>2jmj7l5rSw0yVb/vlWAYkK/YBwk=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
YdKNSPWnx630AYeZ6AXVco1b0RMo8C3WWbziq7C009gg4nhknEZmH0ds78y328SgAlAAVR6Swwok
HE3OWgL8TZ1Ks0IimmmDd8/XIb2KlfiqnUNtTjGjUn9FLQEv/CMbmrCr7EO9rf/N+0cyAyGzrKo5
ieEQhtZy9uZAKh2mrmM=
</ds:SignatureValue>
<ds:KeyInfo>
<wsse:SecurityTokenReference>
<wsse:Reference URI="#X509TokenRef"/>
</wsse:SecurityTokenReference>
</ds:KeyInfo></ds:Signature><wsse:BinarySecurityToken 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#X509v3" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="X509TokenRef">MIIDITCCAsugAwIBAgIQIdu5EMFuQntM5IBOMeFcETANBgkqhkiG9w0BAQUFADCBqTEWMBQGA1UE
ChMNVmVyaVNpZ24sIEluYzFHMEUGA1UECxM+d3d3LnZlcmlzaWduLmNvbS9yZXBvc2l0b3J5L1Rl
c3RDUFMgSW5jb3JwLiBCeSBSZWYuIExpYWIuIExURC4xRjBEBgNVBAsTPUZvciBWZXJpU2lnbiBh
dXRob3JpemVkIHRlc3Rpbmcgb25seS4gTm8gYXNzdXJhbmNlcyAoQylWUzE5OTcwHhcNMDQwODA1
MDAwMDAwWhcNMDQwODE5MjM1OTU5WjBhMQswCQYDVQQGEwJJVDENMAsGA1UECBMEUk9NQTENMAsG
A1UEBxQEcm9tYTEOMAwGA1UEChQFaXNzcGExDjAMBgNVBAsUBWNoaWVmMRQwEgYDVQQDFAt3d3cu
dGVzdC5pdDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAtIsomDk9VthgMorPmG0dAwqLtTBi
U69liwopwrnAbtzIiO56R9yh4tXvG9+QWtEFRcDHVwWi9YdaHQFCvjymnNYDUHkpJsWp11nIAfOA
k+d9v1YDje4S6oba7tsIJSEkUu7LQ888Q3cGt/KUaEu6b0lZJ5zY9slK0onUPeTB3e8CAwEAAaOB
0TCBzjAJBgNVHRMEAjAAMAsGA1UdDwQEAwIFoDBCBgNVHR8EOzA5MDegNaAzhjFodHRwOi8vY3Js
LnZlcmlzaWduLmNvbS9TZWN1cmVTZXJ2ZXJUZXN0aW5nQ0EuY3JsMFEGA1UdIARKMEgwRgYKYIZI
AYb4RQEHFTA4MDYGCCsGAQUFBwIBFipodHRwOi8vd3d3LnZlcmlzaWduLmNvbS9yZXBvc2l0b3J5
L1Rlc3RDUFMwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMA0GCSqGSIb3DQEBBQUAA0EA
Y66OqTOpHcpNUPlD4A38s8bPIIjrf+C+Wv08lUj+DGN5pm+gBWdbWEGaQmqU8fPPtGrQnHz2NAUr
ZmLaEw/qKw==</wsse:BinarySecurityToken></wsse:Security></SOAP-ENV:Header>
<SOAP-ENV:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="MyId">
<aTag>
<aChild>a value</aChild>
</aTag>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
NOTE: Check the value of <ds:SignatureValue> and <ds:DigestValue>: they never change even if I change the body of the source message.Quoting Farrukh's reply to this question on java.net -
I can share some examples of how I have used JWSDP 1.4 and XML DSIG API to sign and verify a "standalone" soap message with and without mime attachments.
Please see the following Utility class written for the freebXML Registry project [1] for an example of how to do what you seek:
http://cvs.sourceforge.net/viewcvs.py/ebxmlrr/omar/src/java/org/freebxml/omar/common/security/SecurityUtil.java?view=markup
See methods signSOAPMessage(...), signPayload(...), verifySOAPMessage(...) and verifyPayloadSignature(...)
What you are trying to do is definitely doable and has been done with JWSDP 1.4. In my experience XML DSIG API met my needs very well.
Best of luck.
[1] freebXML Registry Project:
http://ebxmlrr.sourceforge.net
--------------------------------------------------------------------------------- -
Error when parsing SOAP message from JSP
i write a class to call SOAP message from a servlet on jdev 1013
when i run the class alone it works fine
soapMessage = this.buildSOAPMessagee();
ByteArrayOutputStream output = new ByteArrayOutputStream();
soapMessage.writeTo(output);
SOAPConnectionFactory connf = SOAPConnectionFactory.newInstance();
SOAPConnection conn = connf.createConnection();
SOAPMessage smsg= conn.callsoapMessage, "http://190.0.0.16:8988/mmsc/httpReceiver");
smsg.writeTo(out);
but when running same class same method from jsp page...i have Exception
javax.xml.soap.SOAPException: Unable to get header stream in saveChanges at oracle.j2ee.ws.saaj.soap.MessageImpl.saveChangesMimeEncoded(MessageImpl.java:576) at oracle.j2ee.ws.saaj.soap.MessageImpl.saveChanges(MessageImpl.java:622) at oracle.j2ee.ws.saaj.soap.MessageImpl.saveChanges(MessageImpl.java:686) at oracle.j2ee.ws.saaj.soap.MessageImpl.writeTo(MessageImpl.java:702) at test.test2.ret(test2.java:341) at untitled1.jspService(_untitled1.java:45) [untitled1.jsp] at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.0.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:60) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:416) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:478) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:401) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:119) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230) at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298) at java.lang.Thread.run(Thread.java:595)Caused by: java.io.IOException: SOAP exception while trying to externalize: Error parsing envelope: (1, 1) Start of root element expected. at oracle.j2ee.ws.saaj.soap.SOAPPartImpl.getContentAsStream(SOAPPartImpl.java:220) at oracle.j2ee.ws.saaj.soap.MessageImpl.getHeaderBytes(MessageImpl.java:522) at oracle.j2ee.ws.saaj.soap.MessageImpl.saveChangesMimeEncoded(MessageImpl.java:574) ... 23 moreCaused by: javax.xml.soap.SOAPException: Error parsing envelope: (1, 1) Start of root element expected. at oracle.j2ee.ws.saaj.soap.soap11.SOAPImplementation11.createEnvelope(SOAPImplementation11.java:104) at oracle.j2ee.ws.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:76) at oracle.j2ee.ws.saaj.soap.SOAPPartImpl.getContentAsStream(SOAPPartImpl.java:215) ... 25 moreCaused by: oracle.xml.parser.v2.XMLParseException: Start of root element expected. at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:320) at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:333) at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:295) at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:201) at oracle.j2ee.ws.saaj.soap.soap11.SOAPImplementation11.createEnvelope(SOAPImplementation11.java:78) ... 27 more
dose anybody can help why that happend when running the code from JSPi write a class to call SOAP message from a servlet on jdev 1013
when i run the class alone it works fine
soapMessage = this.buildSOAPMessagee();
ByteArrayOutputStream output = new ByteArrayOutputStream();
soapMessage.writeTo(output);
SOAPConnectionFactory connf = SOAPConnectionFactory.newInstance();
SOAPConnection conn = connf.createConnection();
SOAPMessage smsg= conn.callsoapMessage, "http://190.0.0.16:8988/mmsc/httpReceiver");
smsg.writeTo(out);
but when running same class same method from jsp page...i have Exception
javax.xml.soap.SOAPException: Unable to get header stream in saveChanges at oracle.j2ee.ws.saaj.soap.MessageImpl.saveChangesMimeEncoded(MessageImpl.java:576) at oracle.j2ee.ws.saaj.soap.MessageImpl.saveChanges(MessageImpl.java:622) at oracle.j2ee.ws.saaj.soap.MessageImpl.saveChanges(MessageImpl.java:686) at oracle.j2ee.ws.saaj.soap.MessageImpl.writeTo(MessageImpl.java:702) at test.test2.ret(test2.java:341) at untitled1.jspService(_untitled1.java:45) [untitled1.jsp] at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.0.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:60) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:416) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:478) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:401) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:119) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230) at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298) at java.lang.Thread.run(Thread.java:595)Caused by: java.io.IOException: SOAP exception while trying to externalize: Error parsing envelope: (1, 1) Start of root element expected. at oracle.j2ee.ws.saaj.soap.SOAPPartImpl.getContentAsStream(SOAPPartImpl.java:220) at oracle.j2ee.ws.saaj.soap.MessageImpl.getHeaderBytes(MessageImpl.java:522) at oracle.j2ee.ws.saaj.soap.MessageImpl.saveChangesMimeEncoded(MessageImpl.java:574) ... 23 moreCaused by: javax.xml.soap.SOAPException: Error parsing envelope: (1, 1) Start of root element expected. at oracle.j2ee.ws.saaj.soap.soap11.SOAPImplementation11.createEnvelope(SOAPImplementation11.java:104) at oracle.j2ee.ws.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:76) at oracle.j2ee.ws.saaj.soap.SOAPPartImpl.getContentAsStream(SOAPPartImpl.java:215) ... 25 moreCaused by: oracle.xml.parser.v2.XMLParseException: Start of root element expected. at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:320) at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:333) at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:295) at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:201) at oracle.j2ee.ws.saaj.soap.soap11.SOAPImplementation11.createEnvelope(SOAPImplementation11.java:78) ... 27 more
dose anybody can help why that happend when running the code from JSP -
Hi,
I would like to know how efficient would be to use Oracle Text to parse SOAP messages. The body of the SOAP messages are heterogeneous in terms of format and size (smallest messages is about 20 lines, biggest message is about 200 lines). The number of records to parse is approximately one hundred thousand every hour.
Thank you.In what sense do you want to "parse" them? Do you just want to find individual strings in the SOAP messages, or are you looking to fully interpret the meaning and content of the SOAP messages? If it's the second of these, then Oracle Text is not the right solution - you could perhaps look at Oracle XML Database instead.
-
How to parse a entire SOAP Message
It seems that there is no API in JAXM for parse a entire SOAP Message.
And how to set encoding of a SOAP Message?I can use Apache SOAP for parsing before. There is a class named
Envelope that has a method unmarshall(Element). So I can parse
SOAP message as a common DOM, then change to SOAP Message
using unmarshall. But in JAXP/JAXM, there is no such a class to work. -
Parsing Soap Message Exception
In my environment, flex looks like unable to parse soap
message if MTOM and SWA of my web services were enabled. Can anyone
help me?Which version of Flexbuilder are you using? FB2.01 just
support SOAP 1.1,or am I wrong?
What exactly do you mean with SWA (seems not to be any
offical shortterm of w3c)?
best regards
kcell -
Creating, Sending, Receive + Parsing SOAP messages
Hi all
I have a requirement to set up a system to send and receive SOAP messages. I googled for some tutorials and found one that used an Apache library. But I also see that Java 6 has got quite a bit of SOAP built-in. Are the built-in SOAP classes ready for prime time or should I use apache?
If anyone has a code snippet they could post that would also be appreciated.JAX-WS (which is part of Java 6) is definitely ready for prime time.
It's also a whole lot easier to use.
I'd definitely go with the JAX-WS route. -
Incoming soap message not parsed
From a BPEL process I invoke a web service deployed on the oc4j containers of JDev 9.0.4.
The SOAP message looks like this:
<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>
<ns1:invokeMethod soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://acm.org/samples">
<paramsXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="xsd:string">
<Parameters>x<ParameterName></ParameterName><ParameterValue>y</ParameterValue></Parameters>
</paramsXML>
</ns1:invokeMethod>
</soapenv:Body>
</soapenv:Envelope>
The java class that implements the web service (it expects a String argument) gets an empty String instead of the contents of paramsXML above. What is going wrong?If you want to use raw XML using xsd:string with an RPC-Encoded service developed using a java String as a parameter, you will have to encode your XML on the sender side.
The request should looks like this:
<?xml version = '1.0' encoding = 'UTF-8'?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://acm.org/samples">
<env:Body>
<ns0:invokeMethod env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<paramsXML xsi:type="xsd:string">
& l t ;Parameters>x& l t ;ParameterName>& l t ;/ParameterName>& l t ;ParameterValue>y& l t ;/ParameterValue>& l t ;/Parameters></paramsXML>
</ns0:invokeMethod>
</env:Body>
</env:Envelope>
note that the '<' are replaced by the '& l t ;' entity in the request {with extra space in the entity to render here}. -
XI SOAP adapter : Error during parsing the SOAP part
Hello experts,
We have several scenarios SOAP to IDocs.
We are on XI 3.0 SP19, and since 9/6/09 around 4:00 PM GMT, our SOAP channels used to communicate with a specific 3rd party all stoped accepting incoming SOAP requests. All the messages are stucked on third party side, and we get the following error in the defaulttrace and application logs :
#1.5#001125A5BCD00066000076850013109E00046BF6A963E479#1244607054865#/Applications/ExchangeInfrastructure/AdapterFramework/SAPLibraries/SAPXDK#sap.com/com.sap.aii.af.soapadapter#com.sap.aii.messaging.mo.Message.reparseRootDocument()#PIMSOAP#21217##pxaci_PXA_6443451#PIMSOAP#a71ebfa0556d11decc24001125a5bcd0#SAPEngine_Application_Thread[impl:3]_50##0#0#Error#1#com.sap.aii.messaging.mo.Message#Plain###Error during parsing the SOAP part --- java.lang.NullPointerException#
It happened at the same time on all the environments for every interfaces using SOAP message from this sender to XI. That's the reason why we think it is a global issue, but we can not find anything concerning this error. Has anybody encountered this error or would have any clue of where it comes from ?
Many thanks,
Best regards,
GuislainHello Michal,
Thanks a lot for your help. Actualy we have tested with SOAP UI yesterday and this is what came out of the tests :
test 1 : we tried to call the XI service with the wsdl and put dummy data inside --> test OK
test 2 : we loaded in SOAP UI one of the file from our partner and tried to call the service --> test NOT OK
test 3 : we realized that there were some blank lines at the beginning of the file provided by the partner. we removed these blank lines --> test OK.
So we first thought that the format of the file sent by the partner was wrong and this is why we were getting the parsing error, because of these blank line. The thing is that these blank lines have always been here ! We have checked with old successful messages and they contain also these lines and if we test them in SOAP UI we get an error also. so it does not seems to come from this.
Moreover, as I said in my previous message, it happened on all the environments approximatly at the same time, so we are suspecting a global problem, but which one ? That's the million dollar question
Would you have any other ideas ?
Thanks a lot,
Best regards,
Guislain
Maybe you are looking for
-
On December 31st the client would have open service orders in old company code. We wish to transfer these service orders to a new company code. How to calculate WIP and post balances to WBS in the service orders in new company code. Getting lost! Any
-
Importing transport request bypassing quality system
HI, I have a transport request in DEV BW system which is released. For some reason my Quality BW system is down so I cannot import the request in Quality BW system. Usually we release the request from DEV , say request number DBIK1234, then import th
-
Convert audio from mono to stereo
I have imported video and audio from a camera with microphone, and the audio is only playing out of the left speaker. This is despite the fact that both A1 and A2 channels in the timeline appear to have audio. I'm new to this, and any help to get the
-
Init context node during runtime
Hi together, i have a question concerning initialization of a context node during runtime. I designed my context like Parent Child1 Child2 Child3 The parent node is the only one where the attribute boldInitializati
-
Trashed my Project in 10.1.1 by mistake
Hi. I recently updated FCPX to 10.1.1. By mistake, stupidly, I dragged my project into the trash bin. I did not empty the bin. Undo did not work. I have since tried my best, but I cannot seem to find the project or open it. In the trash, the shots (.