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 Nalini Srivastava <Na...@headstrong.com> on 2007/03/02 07:42:42 UTC

RE: [axis2] problem with 'enableRESTInAxis2MainServlet' flag

Hi,

 

I am trying to enable my webservice to handle both REST and SOAP. I am
currently using ADB for databinding. Also I changed the '
'enableRESTInAxis2MainServlet' flag to true in axis2.xml file. Please
see the file snippet below:

 

 

 

    <!--parameters help to tweak the message handling of two main
servlets. -->

 

    <!-- If the enableRESTInAxis2MainServlet is true, then
Axis2MainServlet will handle both SOAP and REST messages -->

    <parameter name="enableRESTInAxis2MainServlet"
locked="true">true</parameter>

 

    <!-- Following parameter will completely disable REST handling in
both the servlets-->

    <parameter name="disableREST" locked="true">false</parameter>

 

    <!-- This will disable the separate servlet we have for REST
handling. -->

    <parameter name="disableSeparateEndpointForREST"
locked="true">true</parameter>

 

After changing the file I regenerated the wsdl and created the aar file
again. When I deployed it on the server(JBoss) and tried invoke the
service using REST I was able to do so. But when I tried to invoke the
service using SOAP client(with the help of stub). I get the following
error.

 

     [java] org.apache.axis2.AxisFault: Transport level information does
not ma

ch with SOAP Message namespace URI; nested exception is:

     [java]     org.apache.axiom.soap.SOAPProcessingException: Transport
level

nformation does not match with SOAP Message namespace URI

     [java]     at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(

ransportUtils.java:126)

     [java]     at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(

ransportUtils.java:67)

     [java]     at
org.apache.axis2.description.OutInAxisOperationClient.send(O

tInAxisOperation.java:252)

     [java]     at
org.apache.axis2.description.OutInAxisOperationClient.execut

(OutInAxisOperation.java:202)

     [java]     at
com.gryphonnetworks.ws.CertifyServiceStub.certifyClient(Cert

fyServiceStub.java:344)

     [java]     at
com.gryphonnetworks.ws.GryphonClient.main(GryphonClient.java

56)

     [java] Caused by: org.apache.axiom.soap.SOAPProcessingException:
Transport

level information does not match with SOAP Message namespace URI

     [java]     at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.iden

ifySOAPVersion(StAXSOAPModelBuilder.java:144)

     [java]     at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<ini

>(StAXSOAPModelBuilder.java:108)

     [java]     at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(

ransportUtils.java:120)

     [java]     ... 5 more

 

Following is my SOAP client code:

 

package com.gryphonnetworks.ws;

 

import java.rmi.RemoteException;

import com.gryphonnetworks.ws.CertifyServiceStub;

import com.gryphonnetworks.common.xsd.ChannelDetails;

import com.gryphonnetworks.common.xsd.CertificationData;

import com.gryphonnetworks.ws.xsd.CertifyClient;

import com.gryphonnetworks.ws.CertifyClientFaultException;

import com.gryphonnetworks.ws.xsd.CertifyClientFault;

import com.gryphonnetworks.ws.xsd.CertifyClientResponse;

 

public class GryphonClient {

      /**

       * If account# == "13", then you will get a AccountNotExistFault.

       * otherwise if you provide an amount > 1000, you will get a
InsufficientFundFaultMessageException,

       * otherwise you will get a response with a balance equal to 1000
- amountWithdrawn. 

       */

      private static String URL =
"http://localhost:8080/axis2/services/CertifyService";

      public static void main(String[] args) {

 

            

             CertifyServiceStub stub = null;

             

             System.out.println("Entering: GryphonClient");

             try {

                        stub = new CertifyServiceStub(URL);

                        CertificationData[] certificationData = new
CertificationData[2];

                        CertificationData cdTemp = new
CertificationData();

                        ChannelDetails [] cahnnelDetails = new
ChannelDetails[1];

                        ChannelDetails temp = new ChannelDetails();

                        

                        temp.setChannelType("EMAIL");

                        temp.setChannelDetails("12345");

                        cahnnelDetails[0] = temp;

                        cdTemp.setChannelDetails(cahnnelDetails);

                        cdTemp.setClientId(124);

                        certificationData[0] = cdTemp;

                        

                        cdTemp = new CertificationData();

                        temp = new ChannelDetails();

                        cahnnelDetails = new ChannelDetails[1];

                        temp.setChannelType("FAX");

                        temp.setChannelDetails("6789");

                        cahnnelDetails[0] = temp;

                        cdTemp.setChannelDetails(cahnnelDetails);

                        cdTemp.setClientId(2489);

                        certificationData[1] = cdTemp;

                        

                        

                        CertifyClient certifyClient = new
CertifyClient();

                        certifyClient.setData(certificationData);

                        /*RestEnabled re = new RestEnabled();

                        re.setArg("Nalini Srivastava");

                        RestEnabledResponse response =
stub.restEnabled(re);*/

 

                        CertifyClientResponse response =
stub.certifyClient(certifyClient);

 

                  System.out.println("After calling the
ws..."+response);

                  if(response != null)

                  {

                        System.out.println("After calling the
ws...response != null");

                        CertificationData[] ret = response.get_return();

                        if(ret != null)

                        {

                              System.out.println("After calling the
ws...ret != null");

                              System.out.println("After calling the
ws...ret[0].getClientId : "+ret[0].getClientId());

                        }

                  }

                  

              } catch (CertifyClientFaultException e) {

                  final CertifyClientFault fault = e.getFaultMessage();

                  System.out.println("The fault is " +
fault.getErrorCode());

              }  catch (RemoteException e) {

                  e.printStackTrace();  

              } catch (Exception e) {

                  e.printStackTrace(); 

              }

                  

      }

}

 

 

Please let me know what I am doing wrong in this.

 

Regards,

Nalini

 

 

-----Original Message-----
From: Nalini Srivastava 
Sent: Wednesday, February 28, 2007 5:36 PM
To: Nalini Srivastava; 'axis-user@ws.apache.org'
Subject: RE: [axis2] REST approach

 

 

Hi, 

 

I am new to web services. I was looking at the 'userguide' provided with
axis2 distribution. The sample has used AXIOM data binding mechanism.
Can we use any other mechanism in it's place for the same example.

 

Regards,

Nalini

 

 

 



 
***The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review,retransmission,dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.***

Re: [axis2] problem with 'enableRESTInAxis2MainServlet' flag

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi  Nalini ;

As I can see you are using Axis2 1.1 release , any possibility of
checking with nightly builds ?
Even in current code base we are no loner use that parameter as well ,
only one parameter to control the REST support.

Thanks
Deepal

> Hi,
>
>  
>
> I am trying to enable my webservice to handle both REST and SOAP. I am
> currently using ADB for databinding. Also I changed the '
> 'enableRESTInAxis2MainServlet' flag to true in axis2.xml file. Please
> see the file snippet below:
>
>  
>
>  
>
>  
>
> *    <!--parameters help to tweak the message handling of two main
> servlets. -->*
>
> * *
>
> *    <!-- If the enableRESTInAxis2MainServlet is true, then
> Axis2MainServlet will handle both SOAP and REST messages -->*
>
> *    <parameter name="enableRESTInAxis2MainServlet"
> locked="true">true</parameter>*
>
> * *
>
> *    <!-- Following parameter will completely disable REST handling in
> both the servlets-->*
>
> *    <parameter name="disableREST" locked="true">false</parameter>*
>
> * *
>
> *    <!-- This will disable the separate servlet we have for REST
> handling. -->*
>
> *    <parameter name="disableSeparateEndpointForREST"
> locked="true">true</parameter>*
>
> * *
>
> After changing the file I regenerated the wsdl and created the aar
> file again. When I deployed it on the server(JBoss) and tried invoke
> the service using REST I was able to do so. But when I tried to invoke
> the service using SOAP client(with the help of stub). I get the
> following error.
>
>  
>
> *     [java] org.apache.axis2.AxisFault: Transport level information
> does not ma*
>
> *ch with SOAP Message namespace URI; nested exception is:*
>
> *     [java]     org.apache.axiom.soap.SOAPProcessingException:
> Transport level*
>
> *nformation does not match with SOAP Message namespace URI*
>
> *     [java]     at
> org.apache.axis2.transport.TransportUtils.createSOAPMessage(*
>
> *ransportUtils.java:126)*
>
> *     [java]     at
> org.apache.axis2.transport.TransportUtils.createSOAPMessage(*
>
> *ransportUtils.java:67)*
>
> *     [java]     at
> org.apache.axis2.description.OutInAxisOperationClient.send(O*
>
> *tInAxisOperation.java:252)*
>
> *     [java]     at
> org.apache.axis2.description.OutInAxisOperationClient.execut*
>
> *(OutInAxisOperation.java:202)*
>
> *     [java]     at
> com.gryphonnetworks.ws.CertifyServiceStub.certifyClient(Cert*
>
> *fyServiceStub.java:344)*
>
> *     [java]     at
> com.gryphonnetworks.ws.GryphonClient.main(GryphonClient.java*
>
> *56)*
>
> *     [java] Caused by: org.apache.axiom.soap.SOAPProcessingException:
> Transport*
>
> *level information does not match with SOAP Message namespace URI*
>
> *     [java]     at
> org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.iden*
>
> *ifySOAPVersion(StAXSOAPModelBuilder.java:144)*
>
> *     [java]     at
> org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<ini*
>
> *>(StAXSOAPModelBuilder.java:108)*
>
> *     [java]     at
> org.apache.axis2.transport.TransportUtils.createSOAPMessage(*
>
> *ransportUtils.java:120)*
>
> *     [java]     ... 5 more*
>
>  
>
> Following is my SOAP client code:
>
>  
>
> package com.gryphonnetworks.ws;
>
>  
>
> import java.rmi.RemoteException;
>
> import com.gryphonnetworks.ws.CertifyServiceStub;
>
> import com.gryphonnetworks.common.xsd.ChannelDetails;
>
> import com.gryphonnetworks.common.xsd.CertificationData;
>
> import com.gryphonnetworks.ws.xsd.CertifyClient;
>
> import com.gryphonnetworks.ws.CertifyClientFaultException;
>
> import com.gryphonnetworks.ws.xsd.CertifyClientFault;
>
> import com.gryphonnetworks.ws.xsd.CertifyClientResponse;
>
>  
>
> public class GryphonClient {
>
>       /**
>
>        * If account# == "13", then you will get a AccountNotExistFault.
>
>        * otherwise if you provide an amount > 1000, you will get a
> InsufficientFundFaultMessageException,
>
>        * otherwise you will get a response with a balance equal to
> 1000 - amountWithdrawn.
>
>        */
>
>       private static String URL =
> "http://localhost:8080/axis2/services/CertifyService";
>
>       public static void main(String[] args) {
>
>  
>
>            
>
>              CertifyServiceStub stub = null;
>
>              
>
>              System.out.println("Entering: GryphonClient");
>
>              try {
>
>                         stub = new CertifyServiceStub(URL);
>
>                         CertificationData[] certificationData = new
> CertificationData[2];
>
>                         CertificationData cdTemp = new
> CertificationData();
>
>                         ChannelDetails [] cahnnelDetails = new
> ChannelDetails[1];
>
>                         ChannelDetails temp = new ChannelDetails();
>
>                        
>
>                         temp.setChannelType("EMAIL");
>
>                         temp.setChannelDetails("12345");
>
>                         cahnnelDetails[0] = temp;
>
>                         cdTemp.setChannelDetails(cahnnelDetails);
>
>                         cdTemp.setClientId(124);
>
>                         certificationData[0] = cdTemp;
>
>                        
>
>                         cdTemp = new CertificationData();
>
>                         temp = new ChannelDetails();
>
>                         cahnnelDetails = new ChannelDetails[1];
>
>                         temp.setChannelType("FAX");
>
>                         temp.setChannelDetails("6789");
>
>                         cahnnelDetails[0] = temp;
>
>                         cdTemp.setChannelDetails(cahnnelDetails);
>
>                         cdTemp.setClientId(2489);
>
>                         certificationData[1] = cdTemp;
>
>                        
>
>                        
>
>                         CertifyClient certifyClient = new CertifyClient();
>
>                         certifyClient.setData(certificationData);
>
>                         /*RestEnabled re = new RestEnabled();
>
>                         re.setArg("Nalini Srivastava");
>
>                         RestEnabledResponse response =
> stub.restEnabled(re);*/
>
>  
>
>                         CertifyClientResponse response =
> stub.certifyClient(certifyClient);
>
>  
>
>                   System.out.println("After calling the ws..."+response);
>
>                   if(response != null)
>
>                   {
>
>                         System.out.println("After calling the
> ws...response != null");
>
>                         CertificationData[] ret = response.get_return();
>
>                         if(ret != null)
>
>                         {
>
>                               System.out.println("After calling the
> ws...ret != null");
>
>                               System.out.println("After calling the
> ws...ret[0].getClientId : "+ret[0].getClientId());
>
>                         }
>
>                   }
>
>                  
>
>               } catch (CertifyClientFaultException e) {
>
>                   final CertifyClientFault fault = e.getFaultMessage();
>
>                   System.out.println("The fault is " +
> fault.getErrorCode());
>
>               }  catch (RemoteException e) {
>
>                   e.printStackTrace(); 
>
>               } catch (Exception e) {
>
>                   e.printStackTrace();
>
>               }
>
>                  
>
>       }
>
> }
>
>  
>
>  
>
> Please let me know what I am doing wrong in this.
>
> * *
>
> Regards,
>
> Nalini
>
>  
>
>  
>
> -----Original Message-----
> From: Nalini Srivastava
> Sent: Wednesday, February 28, 2007 5:36 PM
> To: Nalini Srivastava; 'axis-user@ws.apache.org'
> Subject: RE: [axis2] REST approach
>
>  
>
>  
>
> Hi,
>
>  
>
> I am new to web services. I was looking at the 'userguide' provided
> with axis2 distribution. The sample has used AXIOM data binding
> mechanism. Can we use any other mechanism in it's place for the same
> example.
>
>  
>
> Regards,
>
> Nalini
>
>  
>
>  
>
>  
>
>
> ***The information transmitted is intended only for the person or
> entity to which it is addressed and may contain confidential and/or
> privileged material. Any review,retransmission,dissemination or other
> use of, or taking of any action in reliance upon, this information by
> persons or entities other than the intended recipient is prohibited.
> If you received this in error, please contact the sender and delete
> the material from any computer.***
>

-- 
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"



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