Good Morning Arthur-

Starting with the locator class example located at
./samples/addr/AddressBookServiceLocator.class
will allow you to obtain a service object which will allow you to gain access 
to the properties you desire

I found the wsdl11 tutorial most instructive via /src/RunClient.java
http://esw.w3.org/topic/SparqlProtocolWsdl11Examples

To paraphrase-

//ensure this is declared at the top of your client source file
static String endpoint = "http://localhost:2525/axis/services/sparql-query"; ;

//obtain the service
      SPARQLQueryServiceLocator  service = new SPARQLQueryServiceLocator();

       service.setSparqlQueryEndpointAddress(endpoint);
     
        // Retrieve a reference to the SparqlQuery interface
        SparqlQueryInterface soapQuery = null;
        try {
            soapQuery = service.getSparqlQuery() ;
        } catch (javax.xml.rpc.ServiceException ex) 
       { 
                throw new RuntimeException("Query exception: " + 
ex.getMessage()) ; 
        }

  a.. We next take care of some bookkeeping. The latest SPARQL-Protocol-draft 
XML Schema imports a stub schema file for RDF/XML. Because this schema does not 
fully describe the XML that will be returned when RDF/XML is returned, we must 
give Axis a custom deserializer that can be invoked when RDF/XML is encountered 
in the response to the query operation. In our case, we define a trivial 
deserializer factory (SimpleDeserializerFactory) and deserializer class 
(SimpleDeserializer) that does nothing more than convert the root element of an 
RDF/XML document fragment to its string representation. 

        // We register a stub class to deserialize RDF/XML
        // so that Axis does not complain. A "real" implementation
        // would use a deserialization class that parses the RDF/XML
        // into an appropriate graph representation. Our deserializer
        // simply returns a string representation of the RDF/XML returned.
        TypeMappingRegistry reg = service.getEngine().getTypeMappingRegistry() ;
        TypeMapping tm = (TypeMapping)reg.getTypeMapping("") ;
        tm.register(
            String.class, // the type to deserialize to
            new QName("http://www.w3.org/1999/02/22-rdf-syntax-ns#";, "RDF") ,
            null,         // SerializerFactory
            new SimpleDeserializerFactory()
        );
a.. The next step uses the bean classes to populate the input messages for the 
query operation: 

        QueryRequest q = new QueryRequest() ;
        q.setQuery(query) ;
        // Any default graphs or named graphs would be set here
        //q.setDefaultGraphUri(new URI[] { ... });
        //q.setNamedGraphUri(new URI[] { ... });
a.. Now we're ready to invoke the operation via the interface reference 
retrieved above. The various faults defined in the WSDL are translates to 
appropriately named exceptions. For the purposes of this example, we simply 
propagate any exceptions as RuntimeExceptions. 

        QueryResult result = null;
        try {
            result =  soapQuery.query(q) ;
        } catch (MalformedQuery ex) {
            throw new RuntimeException("Malformed query fault: " + 
ex.getFaultString(), ex) ;
        } catch (QueryRequestRefused refused) {
                throw new RuntimeException("Query request refused fault: " + 
refused.getFaultString(), refused);
        } catch (AxisFault axisFault) {
            throw new RuntimeException("Axis Fault: 
"+axisFault.getFaultString(), axisFault); 
        } catch (RemoteException e) {
            throw new RuntimeException("Remote Exception: "+e.getMessage(), e) 
; 
        }HTHMartin --
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



----- Original Message ----- 
From: "Arthur van Dorp" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, July 17, 2006 8:23 AM
Subject: Reusing the axis serializers [Axis 1.4]


> Hi all
> 
> I'm using Axis 1.4 and java classes generated with WSDL2Java for offering a 
> webservice. The service adds a bit of generated data and is then supposed to 
> store it as a file again in XML. As all the serializers are already there 
> thanks to Axis I'd like to use them. Every generated class has a 
> getSerializer(java.lang.String mechType, java.lang.Class _javaType, 
> javax.xml.namespace.QName _xmlType) function and there's a SerializerFactory. 
> I've looked at the Axis documentation and the source but couldn't figure out 
> how to use getSerializer correctly. Any pointers to documentations or a small 
> example would be very welcome.
> 
> Thanks, Arthur.
> 
> 
> -- 
> 
> 
> Echte DSL-Flatrate dauerhaft für 0,- Euro*!
> "Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

Reply via email to