Hi all... sorry for the disturb but i don't understand :-) ; i have this client:
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.message.SOAPBodyElement;
import org.apache.axis.message.SOAPBody;
import org.apache.axis.utils.XMLUtils;
import javax.xml.rpc.ServiceException;

import java.util.Vector;
import org.w3c.dom.Document;
import javax.xml.namespace.QName;

import org.apache.log4j.Logger;
import java.net.URL;
import java.net.MalformedURLException;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import java.util.*;

import it.eng.napsi.input.individuo.IndividualMarshaller;
public class SimpleAxisClient {

    /**
     * Il logger
     */
    private static final Logger LOG = Logger.getLogger(SimpleAxisClient.class.
            getName());

    private Call getCall(String endpoint, String operation) throws
            ServiceException {

        if (LOG.isDebugEnabled()) {

            LOG.debug("Creating call.....");
        }
        Call result = (Call) (new Service()).createCall();
        try {
            result.setTargetEndpointAddress(new URL(endpoint));

        } catch (MalformedURLException ex) {

            LOG.error(ex);
        }

        result.setOperation(new QName(endpoint, operation), operation);
        if (LOG.isDebugEnabled()) {

            LOG.debug("Done!!");
        }
        return result;
    }

    public Document getDocument(Document doc, String endpoint,
                                String operation) throws Exception {
        Call call = getCall(endpoint, operation);
        Vector result = (Vector) call.invoke(new Object[] {doc});
        //Vector result = (Vector) call.invoke(new SOAPBodyElement[] { new 
SOAPBodyElement( doc.getDocumentElement() )});
        SOAPBodyElement sbe = (SOAPBodyElement) result.get(0);

        if (LOG.isDebugEnabled()) {

            LOG.debug("Body ricevuto: " +
                      XMLUtils.DocumentToString(sbe.getAsDocument()));
        }
        return sbe.getAsDocument();
    }

    public static void main(String args[]) throws Exception {

        IndividualMarshaller ind = new IndividualMarshaller();
        Map envi = new Hashtable();
        envi.put( "codFisc","XXXXXXXXXXXXX" );
        String xmlString = ind.toStringDocument( envi );
        System.out.println( xmlString );
        SimpleAxisClient client = new SimpleAxisClient();
        Call miaCall = client.getCall(
                
"http://localhost:8082/ServicePublisher/services/Interaction","byFiscalCode";);
        Document doc = XMLUtils.newDocument(new 
java.io.ByteArrayInputStream(xmlString.getBytes()));
        System.out.println("doc.getDocumentElement(): " +
                           doc.getDocumentElement().getNodeName());
        Vector result = (Vector) miaCall.invoke
                        (new SOAPBodyElement[] {new SOAPBodyElement(doc.
                getDocumentElement())});
        SOAPBodyElement sbe = (SOAPBodyElement) result.get(0);

        System.out.println( "Ottenuto: "+ XMLUtils.DocumentToString( 
sbe.getAsDocument() ) );
    }
}

This is my service:
package it.eng.napsi.websrv.javabean;


//Java stuff
import org.w3c.dom.Document;
import java.rmi.RemoteException;

//Eng stuff
import it.eng.napsi.util.RetrieveProperties;
import it.eng.napsi.handlers.model.DataHandler;
import it.eng.napsi.handlers.DataHandlerFactory;
import it.eng.napsi.constraint.DataHandlerConstraint;

//Log4j stuff
import org.apache.log4j.Logger;
import it.eng.napsi.handlers.exception.HandlerException;

public class Interaction {

    private String dataSourceName;
    private DataHandler handler;
    private static final Logger LOG = Logger.getLogger(Interaction.class.
            getName());

    public Interaction(){

        try {
            dataSourceName = "anagrafe";
            if( LOG.isDebugEnabled() ){

                LOG.debug( "RetrieveProperties has given to me: "+ 
dataSourceName );
            }
            handler = DataHandlerFactory.getInstance().getHandler(
                    DataHandlerConstraint.JDBC_TYPE, dataSourceName);
        } catch (HandlerException ex) {

            LOG.error("HandlerException", ex);
        }
    }
    public Document byFiscalCode(Document doc) throws RemoteException {
        try {
            return handler.individualSearch(doc);
        } catch (HandlerException ex) {

            throw new RemoteException("HandlerException", ex);
        }
    }

    public Document byUserData(Document input) throws RemoteException {
        try {
            return handler.individualSearch(input);
        } catch (HandlerException ex) {

            throw new RemoteException("HandlerException", ex);
        }
    }
    public Document byFamilyCode(Document input) throws RemoteException {
        try {
            return handler.individualSearch(input);
        } catch (HandlerException ex) {

            throw new RemoteException("HandlerException", ex);
        }
    }

    public Document toponomastic(Document input) throws RemoteException {
        try {
            return handler.toponomasticSearch(input);
        } catch (HandlerException ex) {

            throw new RemoteException("HandlerException", ex);
        }
    }

    public Document update(Document input) throws RemoteException {
        try {
            return handler.update(input);
        } catch (HandlerException ex) {

            throw new RemoteException("HandlerException", ex);
        }

    }
}

This is the wsdl:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://javabean.websrv.napsi.eng.it"; 
xmlns:apachesoap="http://xml.apache.org/xml-soap"; 
xmlns:impl="http://javabean.websrv.napsi.eng.it"; 
xmlns:intf="http://javabean.websrv.napsi.eng.it"; 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
<!--WSDL created by Apache Axis version: 1.2beta3
Built on Aug 01, 2004 (05:59:22 PDT)-->
 <wsdl:types>
  <schema elementFormDefault="qualified" 
targetNamespace="http://javabean.websrv.napsi.eng.it"; 
xmlns="http://www.w3.org/2001/XMLSchema";>
   <import namespace="http://xml.apache.org/xml-soap"/>
   <element name="input" type="apachesoap:Document"/>
   <element name="updateReturn" type="apachesoap:Document"/>
   <element name="doc" type="apachesoap:Document"/>
   <element name="byFiscalCodeReturn" type="apachesoap:Document"/>
   <element name="input1" type="apachesoap:Document"/>
   <element name="byUserDataReturn" type="apachesoap:Document"/>
   <element name="input2" type="apachesoap:Document"/>
   <element name="byFamilyCodeReturn" type="apachesoap:Document"/>
   <element name="input3" type="apachesoap:Document"/>
   <element name="toponomasticReturn" type="apachesoap:Document"/>
  </schema>
 </wsdl:types>

   <wsdl:message name="toponomasticRequest">

      <wsdl:part element="impl:input3" name="input"/>

   </wsdl:message>

   <wsdl:message name="updateResponse">

      <wsdl:part element="impl:updateReturn" name="updateReturn"/>

   </wsdl:message>

   <wsdl:message name="byFamilyCodeRequest">

      <wsdl:part element="impl:input2" name="input"/>

   </wsdl:message>

   <wsdl:message name="byUserDataRequest">

      <wsdl:part element="impl:input1" name="input"/>

   </wsdl:message>

   <wsdl:message name="toponomasticResponse">

      <wsdl:part element="impl:toponomasticReturn" name="toponomasticReturn"/>

   </wsdl:message>

   <wsdl:message name="byFamilyCodeResponse">

      <wsdl:part element="impl:byFamilyCodeReturn" name="byFamilyCodeReturn"/>

   </wsdl:message>

   <wsdl:message name="updateRequest">

      <wsdl:part element="impl:input" name="input"/>

   </wsdl:message>

   <wsdl:message name="byUserDataResponse">

      <wsdl:part element="impl:byUserDataReturn" name="byUserDataReturn"/>

   </wsdl:message>

   <wsdl:message name="byFiscalCodeResponse">

      <wsdl:part element="impl:byFiscalCodeReturn" name="byFiscalCodeReturn"/>

   </wsdl:message>

   <wsdl:message name="byFiscalCodeRequest">

      <wsdl:part element="impl:doc" name="doc"/>

   </wsdl:message>

   <wsdl:portType name="Interaction">

      <wsdl:operation name="update" parameterOrder="input">

         <wsdl:input message="impl:updateRequest" name="updateRequest"/>

         <wsdl:output message="impl:updateResponse" name="updateResponse"/>

      </wsdl:operation>

      <wsdl:operation name="byFiscalCode" parameterOrder="doc">

         <wsdl:input message="impl:byFiscalCodeRequest" 
name="byFiscalCodeRequest"/>

         <wsdl:output message="impl:byFiscalCodeResponse" 
name="byFiscalCodeResponse"/>

      </wsdl:operation>

      <wsdl:operation name="byUserData" parameterOrder="input">

         <wsdl:input message="impl:byUserDataRequest" name="byUserDataRequest"/>

         <wsdl:output message="impl:byUserDataResponse" 
name="byUserDataResponse"/>

      </wsdl:operation>

      <wsdl:operation name="byFamilyCode" parameterOrder="input">

         <wsdl:input message="impl:byFamilyCodeRequest" 
name="byFamilyCodeRequest"/>

         <wsdl:output message="impl:byFamilyCodeResponse" 
name="byFamilyCodeResponse"/>

      </wsdl:operation>

      <wsdl:operation name="toponomastic" parameterOrder="input">

         <wsdl:input message="impl:toponomasticRequest" 
name="toponomasticRequest"/>

         <wsdl:output message="impl:toponomasticResponse" 
name="toponomasticResponse"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="InteractionSoapBinding" type="impl:Interaction">

      <wsdlsoap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="update">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="updateRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="updateResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="byFiscalCode">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="byFiscalCodeRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="byFiscalCodeResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="byUserData">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="byUserDataRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="byUserDataResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="byFamilyCode">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="byFamilyCodeRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="byFamilyCodeResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="toponomastic">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="toponomasticRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="toponomasticResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="InteractionService">

      <wsdl:port binding="impl:InteractionSoapBinding" name="Interaction">

         <wsdlsoap:address 
location="http://localhost:8080/ServicePublisher/services/Interaction"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>

This is the axis.wsdd service definition:
    <service name="Interaction" type="" regenerateElement="false"
        provider="java:MSG" style="message" use="literal" validate="false">
        <parameter name="scope" value="Request" regenerateElement="false"/>
        <parameter name="className"
            value="it.eng.napsi.websrv.javabean.Interaction" 
regenerateElement="false"/>
        <parameter name="allowedMethods" value="*" regenerateElement="false"/>
        <namespace>http://javabean.websrv.napsi.eng.it</namespace>
    </service>

I'm using JBuilder 2005, Axis1.2RC3, JBoss3.2.6, JVM1.4.2_07; when i try this 
client the request SOAP message is:

POST /ServicePublisher/services/Interaction HTTP/1.0

Content-Type: text/xml; charset=utf-8

Accept: application/soap+xml, application/dime, multipart/related, text/*

User-Agent: Axis/1.2RC3

Host: 127.0.0.1:8082

Cache-Control: no-cache

Pragma: no-cache

SOAPAction: ""

Content-Length: 351



<?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>
         <ricercaIndividuo>
            <codiceFiscale>XXXXXXXXXXXXX</codiceFiscale>
         </ricercaIndividuo>
      </soapenv:Body>
   </soapenv:Envelope>

Well the response is:
HTTP/1.1 500 Internal Server Error

X-Powered-By: Servlet 2.4; Tomcat-5.0.28/JBoss-3.2.6 (build: CVSTag=JBoss_3_2_6 
date=200410140106)

Content-Type: text/xml;charset=utf-8

Date: Wed, 27 Apr 2005 13:14:37 GMT

Server: Apache-Coyote/1.1

Connection: close



<?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>
         <soapenv:Fault>
            <faultcode>soapenv:Server.generalException</faultcode>
            <faultstring>Couldn't find an appropriate operation for XML QName 
ricercaIndividuo</faultstring>
            <detail>
               <ns1:hostname 
xmlns:ns1="http://xml.apache.org/axis/";>PORT-IMMEDIATA</ns1:hostname>
            </detail>
         </soapenv:Fault>
      </soapenv:Body>
   </soapenv:Envelope>

Can anybody tell me why?
Thanks




____________________________________________________________
Navighi a 4 MEGA e i primi 3 mesi sono GRATIS. 
Scegli Libero Adsl Flat senza limiti su http://www.libero.it


Reply via email to