axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lethi <leha1...@yahoo.com>
Subject axis2 client
Date Fri, 12 Aug 2011 09:08:44 GMT

Hi,

I created some web services with WSIG, an jade application using Asix 1.4,
(see in the wsdl file) and all work well (I test with interne SoapClient)
now I have to develop a soap client from an externe java application. For
that, I tried to use asix2 (last version). Axiom for generating a client (is
XMLBeans better complex schema of data?)  I put all .jar files of axis2's
lib in classpath but nothing work. 

Would you help me to create the stub classes and after client classes?


There are errors whan i run the RpcClient.jave:

Exception in thread "main" org.apache.axis2.AxisFault: First Element must
contain the local name, Envelope , but found definitions
        at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
        at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:123)
        at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
        at
org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
        at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
        at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
        at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
        at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:540)
        at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:521)
        at
org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:102)
        at requests.searchprofil.RpcClient.main(RpcClient.java:87)
Caused by: org.apache.axiom.soap.SOAPProcessingException: First Element must
contain the local name, Envelope , but found definitions
        at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:305)
        at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:252)
        at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:234)
        at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
        at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:204)
        at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:154)
        at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:140)
        at
org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:686)
        at
org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:215)
        at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
        at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:108)

And the class file:

package requests.searchprofil;

import java.util.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import javax.xml.namespace.QName;

import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
//import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.rpc.client.RPCServiceClient;

import objectsEtoile.CompetenceFunctional;
import objectsEtoile.CompetenceTechnique;
import objectsEtoile.Profil;
import objectsEtoile.Researchprofil;
import objectsEtoile.Stockcvlist;

public class RpcClient {

        public static void main(String[] args1) throws AxisFault {

                RPCServiceClient serviceClient = new RPCServiceClient();

        Options options = serviceClient.getOptions();

        EndpointReference targetEPR = new
EndpointReference("http://localhost:8080/Etoile/ws/PlanningcvFunctions?WSDL");
        options.setTo(targetEPR);

        /*
          * Fetching a list of Profil from the Address book
          */

        // QName of the method to invoke

        QName opFindEntry = new
QName("http://localhost:8080/Etoile/ws/PlanningcvFunctions?WSDL",
"Researchprofil");
//        QName opFindEntry = new
QName("http://localhost:8080/Etoile/detail.jsp?service=PlanningcvFunctions",
"Researchprofil");

        /*
          * Constructing a new Entry
          */
        CompetenceTechnique ct= new CompetenceTechnique();
        ct.setId_tech(2);
        ct.setName_Tech("java");
        ct.setFather_tech(0);
        ct.setNiveau_tech("expert");

        CompetenceFunctional cf = new CompetenceFunctional();
        cf.setId_fonct(05);
        cf.setName_fonct("j2ee");
        cf.setFather_fonct(2);
        cf.setNiveau_fonct("confirme");

        Profil p = new Profil();

                /**
                * W3C-ISO8601 date format used in conversion from String to
Date
                */
//        SimpleDateFormat zulu = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
//        try {
//                      Date d=
(Date)zulu.parseObject("2011-10-26T21:32:52.000");
//                      System.out.println("date: "+d.toString());
//                      p.setAvaibility(d);
//              } catch (ParseException e) {
//                      // TODO Auto-generated catch block
//                      e.printStackTrace();
//              }

        p.setIdent(0);
        p.setName("");
        p.setApplication(1); // 1= Planning, 2= Record
        p.addTechcompetences(ct);
        p.addFunctionalcompetences(cf);

        Researchprofil entry= new Researchprofil();
        entry.setProfil(p);


        Object[] opFindEntryArgs = new Object[] { entry };
                System.out.println("entry: "+entry.getProfil().toString());
                System.out.println("entryO: "+opFindEntryArgs.toString());
        Class[] returnTypes = new Class[] { Profil.class };

        Object[] response =
serviceClient.invokeBlocking(opFindEntry,opFindEntryArgs, returnTypes);

        Stockcvlist result = (Stockcvlist) response[0];

        if (result == null) {
            System.out.println("No entry found for " + entry);
            return;
        }

        System.out.println("Profils list  :" +
result.getAllCvlist().toString());
    }
}

there is wsdl file content:
  <?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions name="PlanningcvFunctions"
targetNamespace="urn:PlanningcvFunctions"
xmlns:impl="urn:PlanningcvFunctions"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <wsdl:types>
- <xsd:schema targetNamespace="urn:PlanningcvFunctions"
xmlns:impl="urn:PlanningcvFunctions"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:annotation />
- <xsd:element name="Researchprofil">
- <xsd:complexType>
- <xsd:sequence>
  <xsd:element name="Profil" type="impl:Profil" />
  </xsd:sequence>
  </xsd:complexType>
  </xsd:element>
- <xsd:complexType name="Profil">
- <xsd:sequence>
  <xsd:element name="ident" type="xsd:int" />
  <xsd:element minOccurs="0" name="application" type="xsd:int" />
  <xsd:element minOccurs="0" name="name" type="xsd:string" />
  <xsd:element minOccurs="0" name="avaibility" type="xsd:dateTime" />
  <xsd:element name="techcompetences" type="impl:ArrayOfCompetenceTechnique"
/>
  <xsd:element name="functionalcompetences"
type="impl:ArrayOfCompetenceFunctional" />
  </xsd:sequence>
  </xsd:complexType>
- <xsd:complexType name="ArrayOfCompetenceTechnique">
- <xsd:sequence>
  <xsd:element maxOccurs="unbounded" minOccurs="0"
name="CompetenceTechnique" type="impl:CompetenceTechnique" />
  </xsd:sequence>
  </xsd:complexType>
- <xsd:complexType name="CompetenceTechnique">
- <xsd:sequence>
  <xsd:element minOccurs="0" name="id_tech" type="xsd:int" />
  <xsd:element minOccurs="0" name="name_tech" type="xsd:string" />
  <xsd:element minOccurs="0" name="father_tech" type="xsd:int" />
  <xsd:element minOccurs="0" name="niveau_tech" type="xsd:string" />
  </xsd:sequence>
  </xsd:complexType>
- <xsd:complexType name="ArrayOfCompetenceFunctional">
- <xsd:sequence>
  <xsd:element maxOccurs="unbounded" minOccurs="0"
name="CompetenceFunctional" type="impl:CompetenceFunctional" />
  </xsd:sequence>
  </xsd:complexType>
- <xsd:complexType name="CompetenceFunctional">
- <xsd:sequence>
  <xsd:element minOccurs="0" name="id_fonct" type="xsd:int" />
  <xsd:element minOccurs="0" name="name_fonct" type="xsd:string" />
  <xsd:element minOccurs="0" name="father_fonct" type="xsd:int" />
  <xsd:element minOccurs="0" name="niveau_fonct" type="xsd:string" />
  </xsd:sequence>
  </xsd:complexType>
- <xsd:element name="ResearchprofilResponse">
- <xsd:complexType>
- <xsd:sequence>
  <xsd:element name="ResearchprofilReturn" type="impl:Profil" />
  </xsd:sequence>
  </xsd:complexType>
  </xsd:element>
- <xsd:element name="Stockcvlist">
- <xsd:complexType>
- <xsd:sequence>
  <xsd:element minOccurs="0" name="cvlist" type="impl:ArrayOfProfil" />
  </xsd:sequence>
  </xsd:complexType>
  </xsd:element>
- <xsd:complexType name="ArrayOfProfil">
- <xsd:sequence>
  <xsd:element maxOccurs="unbounded" minOccurs="0" name="Profil"
type="impl:Profil" />
  </xsd:sequence>
  </xsd:complexType>
- <xsd:element name="StockcvlistResponse">
- <xsd:complexType>
- <xsd:sequence>
  <xsd:element name="StockcvlistReturn" type="impl:ArrayOfProfil" />
  </xsd:sequence>
  </xsd:complexType>
  </xsd:element>
  </xsd:schema>
  </wsdl:types>
- <wsdl:message name="ResearchprofilRequest">
  <wsdl:part name="parameters" element="impl:Researchprofil" />
  </wsdl:message>
- <wsdl:message name="StockcvlistResponse">
  <wsdl:part name="parameters" element="impl:StockcvlistResponse" />
  </wsdl:message>
- <wsdl:message name="StockcvlistRequest">
  <wsdl:part name="parameters" element="impl:Stockcvlist" />
  </wsdl:message>
- <wsdl:message name="ResearchprofilResponse">
  <wsdl:part name="parameters" element="impl:ResearchprofilResponse" />
  </wsdl:message>
- <wsdl:portType name="PlanningcvFunctionsPort">
- <wsdl:operation name="Researchprofil">
  <wsdl:input message="impl:ResearchprofilRequest" />
  <wsdl:output message="impl:ResearchprofilResponse" />
  </wsdl:operation>
- <wsdl:operation name="Stockcvlist">
  <wsdl:input message="impl:StockcvlistRequest" />
  <wsdl:output message="impl:StockcvlistResponse" />
  </wsdl:operation>
  </wsdl:portType>
- <wsdl:binding name="PlanningcvFunctionsBinding"
type="impl:PlanningcvFunctionsPort">
  <wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="Researchprofil">
  <wsdlsoap:operation soapAction="urn:PlanningcvFunctionsAction" />
- <wsdl:input>
  <wsdlsoap:body use="literal" />
  </wsdl:input>
- <wsdl:output>
  <wsdlsoap:body use="literal" />
  </wsdl:output>
  </wsdl:operation>
- <wsdl:operation name="Stockcvlist">
  <wsdlsoap:operation soapAction="urn:PlanningcvFunctionsAction" />
- <wsdl:input>
  <wsdlsoap:body use="literal" />
  </wsdl:input>
- <wsdl:output>
  <wsdlsoap:body use="literal" />
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:service name="PlanningcvFunctionsService">
- <wsdl:port name="PlanningcvFunctionsPort"
binding="impl:PlanningcvFunctionsBinding">
  <wsdlsoap:address
location="http://localhost:8080/Etoile/ws/PlanningcvFunctions" />
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>

Thank a lot and best regard

Lethi

-- 
View this message in context: http://old.nabble.com/axis2-client-tp32248266p32248266.html
Sent from the Axis - Dev mailing list archive at Nabble.com.


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


Mime
View raw message