You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Prateek Asthana <pa...@gmail.com> on 2010/06/09 05:05:25 UTC

Access XML Header/Body element in handlers

I have read the logging handler example which shows the
MessageContext.getEnvelope() method. I would like to take this step
further and see the handlers be able to  parse the header ( or for
that matter body)  XML message and take appropriate actions. Can
someone suggest how I can parse this XML message header or body using
XML API.

Thanks,
Prateek

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


axis2 client with RPC encoded axis server side

Posted by Bartolomeo Nicolotti <bn...@siapcn.it>.
Hello,

I've the attached wsld that's for an RPC encoded service generated with
axis (not2):

I generated the client with this command:

wsdl2java.sh -uri WsUtiPratica.wsdl --noBuildXML -s -d xmlbeans -sp
-o . 

then in java I've this code:

			WsUtiPraticaServiceStub wsutipratica = new
WsUtiPraticaServiceStub(uri_WsUti);
			CalcolaBolloDocument calcolaBolloDoc =
CalcolaBolloDocument.Factory.newInstance();
			CalcolaBollo calcBollo = calcolaBolloDoc.addNewCalcolaBollo();
			StructCalcolaBolloIn scbi = calcBollo.addNewStructCalcolaBolloIn();

			scbi.setCodSocieta(codsoc);
			scbi.setMastroCli(contoCli.getMastroTrim());
			scbi.setGruppoCli(contoCli.getGruppoTrim());
			scbi.setContoCli(contoCli.getContoTrim());
			scbi.setSottocontoCli(contoCli.getSottocontoTrim());
			scbi.setAnnoStagioneProdotto(annoStagioneProdotto);
			scbi.setStagioneProdotto(stagioneProdotto);
			scbi.setCodiceProdotto(codiceProdotto);
			scbi.setFlagAtlanteTropico("T");//tropico
			scbi.setDataRegistrazione(FrmData.formatDateClassic(nowYYYYMMDD));
			scbi.setTotalePratica(prezzo_tot_lordo_msg);
			
			CalcolaBolloResponseDocument cbrs =
wsutipratica.calcolaBollo( calcolaBolloDoc );


I've debugged the call with these values in calcolaBolloDoc:

<calcolaBollo xmlns="http://Servizi.Pratica.APWebServices">
  <structCalcolaBolloIn xmlns="">
    <annoStagioneProdotto>11</annoStagioneProdotto>
    <codSocieta>AZ</codSocieta>
    <codiceProdotto>HTLCEE</codiceProdotto>
    <contoCli>1</contoCli>
    <dataRegistrazione>29/03/2011</dataRegistrazione>
    <flagAtlanteTropico>T</flagAtlanteTropico>
    <gruppoCli>1</gruppoCli>
    <mastroCli>20</mastroCli>
    <sottocontoCli>359851</sottocontoCli>
    <stagioneProdotto>U</stagioneProdotto>
    <totalePratica>303.31</totalePratica>
  </structCalcolaBolloIn>
</calcolaBollo>

I've sniffed the network traffic with a sniffer getting:

POST /standard-atlante-plus/services/WsUtiPratica HTTP/1.1 
Content-Type: text/xml; charset=UTF-8 
SOAPAction: "" 
User-Agent: Axis2 
Host: 192.168.0.104:8080 
Content-Length: 680 

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ser:calcolaBollo xmlns:ser="http://Servizi.Pratica.APWebServices"><structCalcolaBolloIn><annoStagioneProdotto>11</annoStagioneProdotto><codSocieta>AZ</codSocieta><codiceProdotto>HTLCEE</codiceProdotto><contoCli>1</contoCli><dataRegistrazione>29/03/2011</dataRegistrazione><flagAtlanteTropico>T</flagAtlanteTropico><gruppoCli>1</gruppoCli><mastroCli>20</mastroCli><sottocontoCli>359851</sottocontoCli><stagioneProdotto>U</stagioneProdotto><totalePratica>303.31</totalePratica></structCalcolaBolloIn></ser:calcolaBollo></soapenv:Body></soapenv:Envelope>

HTTP/1.1 200 OK 
Server: Apache-Coyote/1.1 
Content-Type: text/xml;charset=utf-8 
Transfer-Encoding: chunked 
Date: Tue, 29 Mar 2011 12:19:04 GMT 

388 
<?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><ns1:calcolaBolloResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://Servizi.Pratica.APWebServices"><calcolaBolloReturn href="#id0"/></ns1:calcolaBolloResponse><multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:StructCalcolaBolloOut" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://Strutture.Pratica.APWebServices"><codErrore xsi:type="xsd:string"></codErrore><importoBollo xsi:type="xsd:double">0.0</importoBollo><messaggio xsi:type="xsd:string"></messaggio><stato xsi:type="xsd:string">OK</stato></multiRef></soapenv:Body></soapenv:Envelope> 
0

but then in java code I've only:

<ns1:calcolaBolloResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://Servizi.Pratica.APWebServices"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <calcolaBolloReturn href="#id0"/>
</ns1:calcolaBolloResponse>

Could you please help me?

Many thanks

Best regards

Bartolomeo




Re: javax.xml.namespace.QName VerifyError

Posted by Andreas Veithen <an...@gmail.com>.
Sounds like a class loader issue. I would try to just remove xml-apis
and jaxrpc. xml-apis is not required on Java 1.5, and chances are high
that the WebSphere runtime contains a suitable version of jaxrpc.

Andreas

On Thu, Jun 10, 2010 at 00:59, William Walsh <WW...@curamsoftware.com> wrote:
> Hi,
>
> I'm seeing this error when I try to mix the invocation of Axis1.4 and Axis2 clients in the same EJB class method (in WebSphere):
>
> nested exception is:
> java.lang.VerifyError: org/apache/axis2/description/AxisOperation.setName(Ljavax/xml/namespace/QName;)V
>
> I believe it's because for Axis 1.4 the class is in jaxrpc-1.1.jar and for Axis2 it's in xml-apis-1.3.02.jar and the client stub classes would have been built accordingly. To support this we need to have both Axis 1.4 and Axis2 jars in the ear file. Has anyone run across this and/or have any suggestions for resolving?
>
> Thanks,
> William
>
>
>
>
>
> The information in this email is confidential and may be legally privileged.
> It is intended solely for the addressee. Access to this email by anyone else
> is unauthorized. If you are not the intended recipient, any disclosure,
> copying, distribution or any action taken or omitted to be taken in reliance
> on it, is prohibited and may be unlawful. If you are not the intended
> addressee please contact the sender and dispose of this e-mail. Thank you.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


RE: javax.xml.namespace.QName VerifyError

Posted by William Walsh <WW...@curamsoftware.com>.
Martin,  That seems like a good approach.  Building Axis 1.4 is no hassle, but I feel I'm going to need to build both it and Axis2 to be at a common JDK (1.5) level and since I've not used Maven before I'm having a bit of trouble.  I've run through the steps, or equivalent in these entries and seem to have it getting through much of the build, but it's failing on tests and not building all I think it should be building, specifically xml-apis.jar.

http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/maven/shared/maven-shared-io/1.1/maven-shared-io-1.1.jar
http://jira.codehaus.org/browse/MNG-4301
http://old.nabble.com/Building-axis2-1.5.1-with-maven2-fails,-due-to-wrong-repos--td27143276.html
http://marc.info/?l=axis-user&m=126450197820931
http://osdir.com/ml/axis-user-ws.apache.org/2010-01/msg00216.html
http://stackoverflow.com/questions/2206687/how-can-i-setup-dependencies-for-axis2-axiom-on-maven2

[DEBUG] Connecting to repository: 'apache-ws-snapshots2' with url: 'http://ws.zones.apache.org/repository2'.^M
Downloading: http://ws.zones.apache.org/repository2/xml-apis/xml-apis/1.3.02/xml-apis-1.3.02.pom^M
[DEBUG] Unable to locate resource in repository^M
org.apache.maven.wagon.ResourceDoesNotExistException: Unable to locate resource in repository^M

If I go to http://ws.zones.apache.org/repository2/ the only directories there, which is presumably why it doesn't find it, are:
Index of /repository2
 Name                    Last modified      Size  Description
 bouncycastle/           14-Feb-2007 14:00    -
 com/                    23-Mar-2007 12:47    -
 opensaml/               14-Feb-2007 13:56    -
 org/                    19-Feb-2008 02:09    -
 wsdl4j/                 02-Feb-2007 15:26    -

So, where can I go to pick this up and where in the configuration do I update to point to it?

Thanks much,
William



From: Martin Gainty [mailto:mgainty@hotmail.com]
Sent: Wednesday, June 09, 2010 4:38 PM
To: William Walsh
Subject: RE: javax.xml.namespace.QName VerifyError

Hi william

VerifyError *generally* indicates bytecode signature mismatch detected by the running JVM on the compiled bytecode of the java classes
http://stackoverflow.com/questions/100107/reasons-of-getting-a-java-lang-verifyerror

i would download all of your source..axis.. xml-apis and jaxrpc sources and recompile all the source with your specific JVM/JDK

hth
Martin
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.





> From: WWalsh@curamsoftware.com
> To: java-user@axis.apache.org
> Date: Wed, 9 Jun 2010 23:59:34 +0100
> Subject: javax.xml.namespace.QName VerifyError
>
> Hi,
>
> I'm seeing this error when I try to mix the invocation of Axis1.4 and Axis2 clients in the same EJB class method (in WebSphere):
>
> nested exception is:
> java.lang.VerifyError: org/apache/axis2/description/AxisOperation.setName(Ljavax/xml/namespace/QName;)V
>
> I believe it's because for Axis 1.4 the class is in jaxrpc-1.1.jar and for Axis2 it's in xml-apis-1.3.02.jar and the client stub classes would have been built accordingly. To support this we need to have both Axis 1.4 and Axis2 jars in the ear file. Has anyone run across this and/or have any suggestions for resolving?
>
> Thanks,
> William
>
>
>
>
>
> The information in this email is confidential and may be legally privileged.
> It is intended solely for the addressee. Access to this email by anyone else
> is unauthorized. If you are not the intended recipient, any disclosure,
> copying, distribution or any action taken or omitted to be taken in reliance
> on it, is prohibited and may be unlawful. If you are not the intended
> addressee please contact the sender and dispose of this e-mail. Thank you.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
________________________________
The New Busy is not the old busy. Search, chat and e-mail from your inbox. Get started.<http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3>


The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorized. If you are not the intended recipient, any disclosure,
copying, distribution or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful. If you are not the intended
addressee please contact the sender and dispose of this e-mail. Thank you.

javax.xml.namespace.QName VerifyError

Posted by William Walsh <WW...@curamsoftware.com>.
Hi,

I'm seeing this error when I try to mix the invocation of Axis1.4 and Axis2 clients in the same EJB class method (in WebSphere):

nested exception is:
java.lang.VerifyError: org/apache/axis2/description/AxisOperation.setName(Ljavax/xml/namespace/QName;)V

I believe it's because for Axis 1.4 the class is in jaxrpc-1.1.jar and for Axis2 it's in xml-apis-1.3.02.jar and the client stub classes would have been built accordingly. To support this we need to have both Axis 1.4 and Axis2 jars in the ear file. Has anyone run across this and/or have any suggestions for resolving?  

Thanks,
William





The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorized. If you are not the intended recipient, any disclosure,
copying, distribution or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful. If you are not the intended
addressee please contact the sender and dispose of this e-mail. Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Access XML Header/Body element in handlers

Posted by Prateek Asthana <pa...@gmail.com>.
All,
In relation to the below, I understand that I will have to use the
SAAJ API to parse through header/body XML elements. The starting point
fo me could be:
MessageContext.getEnvelope() which returns a SOAPEnvelope object. Now
this object belongs to AXIOM API which imples that my parsing code
woudl be AXIOM specific. I have read at:
http://ws.apache.org/axis2/
that AXIS supports SAAJ specifications. Would it not mean that I can
have access to javax.xml.soap.* objects (for example
javax.xml.soap.SOAPBody, javax.xml.soap.SOAPEnvelope and so on).

How do I bridge this gap between AXIOM and SAAJ?  Any advise would be
appreciated.

Thanks,
Prateek


On Tue, Jun 8, 2010 at 11:05 PM, Prateek Asthana <pa...@gmail.com> wrote:
> I have read the logging handler example which shows the
> MessageContext.getEnvelope() method. I would like to take this step
> further and see the handlers be able to  parse the header ( or for
> that matter body)  XML message and take appropriate actions. Can
> someone suggest how I can parse this XML message header or body using
> XML API.
>
> Thanks,
> Prateek
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org