xmlns namespace - weblogic.developer.interest.webservices.general(Archived)

I need to change a xml namespace value. How can this be done? It's the "ns" namespace value. The example below is an rresponse message.
<?xml version="1.0" encoding="utf-8" ?>
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <SOAP-ENV:Body>
- <ns:getAggregationResponse xmlns:ns="http://gcrm.jpmorgan.com/namespace/cit/aggsvc">
- <ns:getAggregationResult>
<ns:CobDate>2007-09-14T00:00:00-04:00</ns:CobDate>
- <ns:Results>
- <ns:anyType xsi:type="ns:LmcObject">
<ns:Client>1559565</ns:Client>
<ns:UltParent>1559565</ns:UltParent>
<ns:PrimaryCapital>1969758</ns:PrimaryCapital>
<ns:GrossPrimaryExposure>685213433</ns:GrossPrimaryExposure>
<ns:NetPrimaryExposure>245850714</ns:NetPrimaryExposure>
<ns:PrimaryNAICCode>524126</ns:PrimaryNAICCode>
<ns:PrimaryNAICDescription>DIRECT PROPERTY AND CASUALTY INSURANCE CARRIERS</ns:PrimaryNAICDescription>
<ns:PrimaryIndustryClass>Insurance, NonLife</ns:PrimaryIndustryClass>
<ns:PrimaryIndustryDivision>Insurance</ns:PrimaryIndustryDivision>
<ns:PrimaryIndustryGroup>Financial Institutions</ns:PrimaryIndustryGroup>
<ns:SecondaryNAICCode>-1</ns:SecondaryNAICCode>
<ns:SecondaryNAICDescription>REFERENCE DATA NOT FOUND</ns:SecondaryNAICDescription>
<ns:SecondaryIndustryClass>REFERENCE DATA NOT FOUND</ns:SecondaryIndustryClass>
<ns:SecondaryIndustryDivision>REFERENCE DATA NOT FOUND</ns:SecondaryIndustryDivision>
<ns:SecondaryIndustryGroup>REFERENCE DATA NOT FOUND</ns:SecondaryIndustryGroup>
</ns:anyType>
</ns:Results>
</ns:getAggregationResult>
</ns:getAggregationResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope> 

Ok, I found the answer to my own question. Use SOAP Message Handlers to update the outgoing soap response message.
It seemed a lot of people had this same question on this forum and there was no answers or at least none i could find. 

I wish I would have posted this earlier:
http://dev2dev.bea.com/blog/cindymc/archive/2007/07/using_soap_head.html
SOAP headers were a bear with JAX-WS, too. 

Can someone from BEA please confirm that you can't set the prefix? I get an error saying UNIMPLEMENTED. Perhaps I am not doing setPrefix on the right node or element.
Is there another workaround?
Code
====
     SOAPBody body = soap.getSOAPBody();
     Iterator iter = body.getChildElements();
     while (iter.hasNext()) {
          SOAPElement element = (SOAPElement)iter.next();
          System.out.println(element.getPrefix());
          element.setPrefix(null);
     }
Exception
========
Exception in thread "Main Thread" java.rmi.RemoteException: SOAPFaultException - FaultCode [{http://schemas.xmlsoap.org/soap/envelope/}Server] FaultString [UNIMPLEMENTED] FaultActor [null] Detail [<detail><bea_fault:stacktrace xmlns:bea_fault="http://www.bea.com/servers/wls70/webservice/fault/1.0.0">java.lang.AssertionError: UNIMPLEMENTED
     at weblogic.xml.domimpl.NodeImpl.setPrefix(NodeImpl.java:171)
     at handler.testHandler.handleResponse(testHandler.java:34)
     at weblogic.wsee.handler.JaxrpcHandlerChain.handleResponse(JaxrpcHandlerChain.java:111) 

It looks like you are trying to play with a SOAP message envelope, we had a similar issue when we were trying to do the same. In the handler init method we had to add the following properties.
          System.setProperty("javax.xml.soap.SOAPConnectionFactory", "weblogic.wsee.saaj.SOAPConnectionFactoryImpl");
          System.setProperty("javax.xml.soap.MessageFactory", "weblogic.xml.saaj.MessageFactoryImpl");
          System.setProperty("javax.xml.soap.SOAPFactory", "weblogic.xml.saaj.SOAPFactoryImpl");
After this we could play around with the soap envelope, removing elements and so forth.
Regards,
Adi.

Related

SOAP Response structure

Hi,
Is there a way to control the structure of SOAP response on placing XAI Inbound request ?
For example,
If i place a Inbound request through XAI Dynamic submission, i get a SOAP Response which is having the following structure
<?xml version="1.0" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="urn:schemas-xmlsoap-org:envelope">
<SOAP-ENV:Body >
............
</SOAP-ENV:Body >
</SOAP-ENV:Envelope>
Is there a way to introduce SOAP Header in this response ? How can i do that
Also, is there a way to control the structure of the SOAP Fault response ?
For example,
If i place a wrong Inbound request through XAI Dynamic submission, i get a SOAP Fault Response which is having the following structure
<?xml version="1.0" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="urn:schemas-xmlsoap-org:envelope">
<SOAP-ENV:Body >
<SOAP-ENV:Fault >
<faultcode> </<faultcode>
<faultstring> </<faultstring>
<detail> </detail>
Is there a way to introduce SOAP actor in this response ? How can i do that.
Thanks in advance for your help 
SOAP Actor is not supported in the current release. 
Thanks ACShorten. Is there a way to introduce SOAP Header in this response ? How can i do that 
Use XSL to do this. You can add a SOAP header. There may be a sample in the install (used to be called AddEnvelope.xsl). 
Anthony, is XSL still required to add a SOAP envelope?

APEX 3.0 Web Service OWS-04052 unrecognized operation SOAP Envelop

Hey,
I run into a problem with WebServices. Short, I implemented a WebService with JDeveloper and now I would like to create ws references in APEX. The ws is working 100% correct so the problem is, that APEX creates a soap envelop which is not 100% correct...
So blabla here it is what APEX generates for request:
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:projectId
xmlns:ns1="http://impl.planning.services.model.azima.promatis.com/">2</ns1:projectId>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Now the request which should be sended: (from EM Console)
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body xmlns:ns1="http://impl.planning.services.model.azima.promatis.com/">
<ns1:getAllElementsOfProject>
<ns1:projectId>2</ns1:projectId>
</ns1:getAllElementsOfProject>
</soap:Body>
</soap:Envelope>
Compare and you will see that the operation info is missing. So it's almost the same but the operation 'getAllElementsOfProject' isn't in the request.
If it helps I could also send the wsdl if requiered for help.
So I run into the following error:
<?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://impl.planning.services.model.azima.promatis.com/"><env:Body><env:Fault><faultcode>env:Client</faultcode><faultstring>Caught exception while handling request: unrecognized operation: {http://impl.planning.services.model.azima.promatis.com/}projectId</faultstring></env:Fault></env:Body></env:Envelope>
From Response
...
2007-05-22 16:41:01.765 WARNING OWS-04052 Bestimmen der Vorgangs-ID aus SOAP-Nachricht nicht m÷glich.
...
In OC4J (sorry german - means that operation-id couldn't be identified)
Do you have any ideas how I could configure this? Before you try to say: make it manually, I won't, because it have to worked automatically!
Thanks
Frank 
Frank:
Since you will not create a manual Web reference, the other thing I can suggest is when you publish the Web service with JDeveloper, make sure you only check the SOAP 1.1 binding option, and choose Document/Literal as the message type.
Thanks,
Jason 
Ok and what is if I can't switch to SOAP 1.1? 
You could try checking both options, 1.1 and 1.2. I would try that as a last resort though. Use only 1.1 if at all possible. 
Ok it's not this forum but maybe...
Is there an annotation to change SOAPBinding? Something like #SOAPVersion( version=1.1 )? 
Ok I tried it with new Version JAX-WS 2.0.1. There is a new annotation where the type of the Enpoint or WebService itseld can be set:
#BindingType( value=SOAPBinding.SOAP11HTTP_BINDING )
So I tried now with SOAP 1.1 but APEX still don't put the operation name in the SOAP request envelope...
Now do anyone out there have a clue what else could be wrong? Did I maybe forget an annotation parameter somewhere or something else? So I do it something like this:
#Stateless
#WebService( name="XXX" )
#BindingType( value=SOAPBinding.SOAP11HTTP_BINDING )
public class XXXImpl implements Ixxx {
#EJB Ia a;
#EJB Ib b;
...
#WebMethod( operationName="foo" )
public ADaoObjectWithNoComplexAttributes foo( Long someId ) {
// do it!
return theDao;
}
...
}
I am appreciate for any help!
Thanks
Message was edited by:
promatis 
I think the reason may be is that the message type is defined as RPC. Can you provide the WSDL? 
Sorry for the long time!
No the standart in Webservice Annotation class is DOCUMENT/LITERAL. The wsdl is fine, sorry can't post it at the moment, I will try again tomorrow. The only workaround to solve the problem is to copy and paste the envelop to APEX.

How to get parameter value from SOAP message

Hi,
Does anyone know how can I get the value of the <symbol>, which is ABCD in the
following case, from a SOAP message sent to a servlet please?
I tried:
String symbol = httpservletrequest.getParameter("symbol");
It does not work. The return value is null.
Or is there a method that I can use in the soapmimemessage class please?
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<SOAP-ENV:Envelope SOAP ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAPSDK1:receive xmlns:SOAPSDK1="urn:Receiver">
<symbol>ABCD</symbol>
</SOAPSDK1:receive>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Thanks,
Barbara
Can't you just use WLS6.1's SOAP -> Bean method mapping, and keep all your webservice
functionality in session beans? Then you just write session beans as normal.
httpservletrequest.getParameter("symbol");
means get the value of the 'symbol' parameter that came after the ? in the URL,
e.g. for URL
www.mysite.com/service?symbol=xyz
HttpServletRequest.getParameter("symbol");
will return xyz.
This is nothing to do with soap method parameters.
"Barbara Leung" <barbara.leung#kodak.com> wrote:
>
Hi,
Does anyone know how can I get the value of the <symbol>, which is ABCD
in the
following case, from a SOAP message sent to a servlet please?
I tried:
String symbol = httpservletrequest.getParameter("symbol");
It does not work. The return value is null.
Or is there a method that I can use in the soapmimemessage class please?
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<SOAP-ENV:Envelope SOAP ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAPSDK1:receive xmlns:SOAPSDK1="urn:Receiver">
<symbol>ABCD</symbol>
</SOAPSDK1:receive>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Thanks,
Barbara

Setting faultstring in com.bea.jws.SoapFaultException

What is the correct procedure for setting the "faultstring" of an object of type
com.bea.jws.SoapFaultException ??
I can set the detail by doing the following:
SoapFaultException except = new SoapFaultException(faultDoc, highLevelError);
except.setCausedBySender(true);
with faultDoc being the XMLBeans representation of the detailed document. I was
thinking the 2nd parameter of the new SoapFaultException might be the faultstring,
but all I get is the following with "faultstring" = Undefined.
Any ideas ??
Thanks,
Jeff
<SOAP-ENV:Envelope 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>
<soapenv:Fault xmlns:chan="http://www.bellsouth.com/BpgProxy/ChangePolicyFault.xsd"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">soapenv:Client</faultcode>
<faultstring>Undefined</faultstring>
<detail>
<chan:changePolicyFault>
<chan:result>false</chan:result>
<chan:errorMessage>Correct Service Class Name??</chan:errorMessage>
<chan:errorValue>-1</chan:errorValue>
</chan:changePolicyFault>
</detail>
</soapenv:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Forgot to mention I am using Weblogic 8.1 SP2
>
What is the correct procedure for setting the "faultstring" of an object
of type
com.bea.jws.SoapFaultException ??
I can set the detail by doing the following:
SoapFaultException except = new SoapFaultException(faultDoc, highLevelError);
except.setCausedBySender(true);
with faultDoc being the XMLBeans representation of the detailed document.
I was
thinking the 2nd parameter of the new SoapFaultException might be the
faultstring,
but all I get is the following with "faultstring" = Undefined.
Any ideas ??
Thanks,
Jeff
<SOAP-ENV:Envelope 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>
<soapenv:Fault xmlns:chan="http://www.bellsouth.com/BpgProxy/ChangePolicyFault.xsd"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">soapenv:Client</faultcode>
<faultstring>Undefined</faultstring>
<detail>
<chan:changePolicyFault>
<chan:result>false</chan:result>
<chan:errorMessage>Correct Service Class Name??</chan:errorMessage>
<chan:errorValue>-1</chan:errorValue>
</chan:changePolicyFault>
</detail>
</soapenv:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Hi Jeff,
The only way I know of to do what you want to do, is to completely take over the
creation of the SOAP fault :-)
I have attached a Java source file, called SOAPFaultExceptionGenerator.java, which
hides most of the complexities for doing this. Here's a code snippet of how you
use it:
import javax.xml.namespace.QName;
import com.bea.jws.SoapFaultException;
import webservices.utils.SOAPFaultExceptionGenerator;
...
public void sayHello(name)
{
throw SOAPFaultExceptionGenerator.createSoapFaultException(
null,
re.getMessage(),
null,
"<MyCustomFault><Message>" + re.getMessage() + "</Message></MyCustomFault>"
);
}
NOTE: The test browser may not show you what the fault looks like, unless you
invoke the Web service from outside of WLW. Afterwards, you can start a test browser
using the .jws, and clicking on one of the "Message Log" links, to see the "real"
fault. A JSP that uses the client proxy JAR for the .jws, satisfies the "outside
of WLW" criteria, but don't expected to catch the SoapFaultException in it. You
can't, for some reason :-)
Regards,
Mike Wooten
"Jeff Cassanova" <jeff.cassanova#bellsouth.com> wrote:
>
Forgot to mention I am using Weblogic 8.1 SP2
What is the correct procedure for setting the "faultstring" of an object
of type
com.bea.jws.SoapFaultException ??
I can set the detail by doing the following:
SoapFaultException except = new SoapFaultException(faultDoc, highLevelError);
except.setCausedBySender(true);
with faultDoc being the XMLBeans representation of the detailed document.
I was
thinking the 2nd parameter of the new SoapFaultException might be the
faultstring,
but all I get is the following with "faultstring" = Undefined.
Any ideas ??
Thanks,
Jeff
<SOAP-ENV:Envelope 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>
<soapenv:Fault xmlns:chan="http://www.bellsouth.com/BpgProxy/ChangePolicyFault.xsd"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">soapenv:Client</faultcode>
<faultstring>Undefined</faultstring>
<detail>
<chan:changePolicyFault>
<chan:result>false</chan:result>
<chan:errorMessage>Correct Service Class Name??</chan:errorMessage>
<chan:errorValue>-1</chan:errorValue>
</chan:changePolicyFault>
</detail>
</soapenv:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>[SOAPFaultExceptionGenerator.java]
If anyone is having problems using the SOAPFaultExceptionGenerator class, they
might to try this newly attached one.
During more extensive testing, "inside" and "outside" of the WLW product, I found
some quirks in how the WLW IDE, deals with the FaultDocument class.
Regards,
Mike Wooten
"Michael Wooten" <wooten_michael#hotmail.com> wrote:
>
>
>
Hi Jeff,
The only way I know of to do what you want to do, is to completely take
over the
creation of the SOAP fault :-)
I have attached a Java source file, called SOAPFaultExceptionGenerator.java,
which
hides most of the complexities for doing this. Here's a code snippet
of how you
use it:
import javax.xml.namespace.QName;
import com.bea.jws.SoapFaultException;
import webservices.utils.SOAPFaultExceptionGenerator;
...
public void sayHello(name)
{
throw SOAPFaultExceptionGenerator.createSoapFaultException(
null,
re.getMessage(),
null,
"<MyCustomFault><Message>" + re.getMessage() + "</Message></MyCustomFault>"
);
}
NOTE: The test browser may not show you what the fault looks like, unless
you
invoke the Web service from outside of WLW. Afterwards, you can start
a test browser
using the .jws, and clicking on one of the "Message Log" links, to see
the "real"
fault. A JSP that uses the client proxy JAR for the .jws, satisfies the
"outside
of WLW" criteria, but don't expected to catch the SoapFaultException
in it. You
can't, for some reason :-)
Regards,
Mike Wooten
"Jeff Cassanova" <jeff.cassanova#bellsouth.com> wrote:
Forgot to mention I am using Weblogic 8.1 SP2
What is the correct procedure for setting the "faultstring" of an object
of type
com.bea.jws.SoapFaultException ??
I can set the detail by doing the following:
SoapFaultException except = new SoapFaultException(faultDoc, highLevelError);
except.setCausedBySender(true);
with faultDoc being the XMLBeans representation of the detailed document.
I was
thinking the 2nd parameter of the new SoapFaultException might be the
faultstring,
but all I get is the following with "faultstring" = Undefined.
Any ideas ??
Thanks,
Jeff
<SOAP-ENV:Envelope 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>
<soapenv:Fault xmlns:chan="http://www.bellsouth.com/BpgProxy/ChangePolicyFault.xsd"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">soapenv:Client</faultcode>
<faultstring>Undefined</faultstring>
<detail>
<chan:changePolicyFault>
<chan:result>false</chan:result>
<chan:errorMessage>Correct Service Class Name??</chan:errorMessage>
<chan:errorValue>-1</chan:errorValue>
</chan:changePolicyFault>
</detail>
</soapenv:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>[SOAPFaultExceptionGenerator.java]

"soap:" prefix not defined in static context - OSB

I am trying to get this value in Assign in OSB project
$body/soap:Fault/faultstring/text()
and getting an error that "soap:" prefix is not defined in static context. Any idea why I am getting this message?
I want to get the value of faultcode and faultstring from the body like below:
<soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Not enough message parts were received for the operation.</faultstring>
</soap:Fault>
</soap:Body> 
You have two options here -
1. In the Message Flow Editor, add a namespace with prefix "soap" and value "http://schemas.xmlsoap.org/soap/envelope/"
In the Message Flow Editor, click a node or an action to display its properties in the Properties view. For most nodes and actions, one of the properties pages displayed (as a tab) is the Namespaces page. Use this page to see a list of defined namespaces or to create a new namespace.refer section "22.4 Creating Namespaces to Use in Inline Expressions" at below link -
http://download.oracle.com/docs/cd/E14571_01/doc.1111/e15867/proxy_editors.htm#i1277817
2. Change the namespace prefix in your input from "soap" to "soap-env" -
<soap-env:Body 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:Fault>
<faultcode>soap-env:Client</faultcode>
<faultstring>Not enough message parts were received for the operation.</faultstring>
</soap-env:Fault>
</soap-env:Body>
Regards,
Anuj

Categories

Resources