Getting the specifications is not hard, but using them is a significant project.

1. Find wsdl4j via web search and use it to analyze the WSDL. It will also collect the schema types you need for the message elements. (There is also some wsdl-cracking machinery in axis2 which may be better.)

2.  You can use the XML Schema API

http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040122/xml-schema-api.html#Interface-XSModel

implemented in the Xerces-J package to traverse the XML Schema components of the types you need for the message. *In principle*, this is enough to construct a form for input of some type and for displaying an instance of a type. 3. If you do this yourself, it's a major project. Most likely there is a way to use XForms.

Jeff

Ernesto Pin wrote:
So, is there any way to easily get both document's specification to store them and use them for later invocation?.

I've been surfing a lot and found anything. Any reference would be very helpful, as I'm using this at university's project for a course, where the time is finite :-P .

2007/10/30, Jeff Greif <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>:

    My guess is the problem is in using the WRAPPED_STR style.  It's
    convenient for getting your input string wrapped up as the desired
    soap:body child element, but it causes the response to be unwrapped,
    and, as a single object is returned, rather than an array, you're
    losing most of the response.  If you use a straight document/literal
    style/use and do your best to forbid automatic wrapping and
    unwrapping,you have to do a little more work on input but you'll have
    the full output.

    I recall having difficulty at one time getting axis 1.4 to stop trying
    to wrap and unwrap.

    If you're going to be using DII for arbitrary WSDLs, you probably
    would not be able to use wrapping and unwrapping anyway -- not all
    doc/lit services can have their responses unwrapped.  You should just
    work with the full documents required for input and output.

    Jeff



    On 10/30/07, Ernesto Pin < [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>> wrote:
    > Hi!. I'm trying to develop a "pure" dynamic client to invoke
    WS's. The idea
    > behind this, is that I can't generate any classes to invoke the
    > web-services. Particularly, I can't use specific classes for
    return types. I
    > thought about using org.w3c.dom.Document as return type, but I'm
    not being
    > successful. The problem I'have, is that, when I return from
    service's
    > invocation, the resultant document only contains the first node
    of the
    > response.
    >
    > I would be very grateful if someone could help me to obtain the
    whole
    > document.
    >
    > Here is my stuff. As you will see, the "conversation" with the
    service is
    > well-made, so I think that my problem is when the result is
    read. I don't
    > know how to read response by myself, or how, where and what
    configure to
    > read it well.
    >
    >
    
-------------------------------------------------------------------------------------

    > wsdl: http://www.webservicex.net/geoipservice.asmx?wsdl
    >
    
-------------------------------------------------------------------------------------

    > Client code (running inside a servlet hosted in jBoss 4.2.1)
    >
    > package concrete;
    >
    > import java.io.IOException;
    > import java.io.PrintWriter;
    > import java.net.MalformedURLException ;
    > import java.net.URL;
    >
    > import javax.servlet.http.HttpServletRequest;
    > import javax.servlet.http.HttpServletResponse;
    > import javax.xml.namespace.QName;
    > import javax.xml.rpc.ServiceException ;
    >
    > import org.apache.axis.client.Call ;
    > import org.apache.axis.client.Service;
    > import org.apache.axis.client.ServiceFactory;
    > import org.apache.axis.constants.Style;
    > import org.apache.axis.constants.Use ;
    > import
    > org.apache.axis.encoding.ser.DocumentDeserializerFactory ;
    > import
    > org.apache.axis.encoding.ser.DocumentSerializerFactory;
    > import org.apache.axis.soap.SOAPConstants;
    > import org.w3c.dom.Document;
    > import org.w3c.dom.Node;
    > import org.w3c.dom.NodeList;
    >
    > import actions.IAction ;
    >
    > public class TestParams implements IAction {
    >
    >     @Override
    >     public void execute(HttpServletRequest req,
    HttpServletResponse resp) {
    >         try {
    >             QName name = new QName(" http://www.webservicex.net ",
    > "GeoIPService");
    >
    >             Service service = (Service) ServiceFactory
    >                     .newInstance()
    >                     .createService(
    >                             new URL(
    >
    > "http://webservicex.net/geoipservice.asmx?wsdl";),
    >                             name);
    >
    >             QName port = new QName( name.getNamespaceURI(),
    > "GeoIPServiceSoap");
    >             QName oper = new QName(name.getNamespaceURI(),
    "GetGeoIP");
    >
    >             Call call = (Call) service.createCall(port, oper);
    >
    >
    >
    call.setTargetEndpointAddress("http://webservicex.net/geoipservice.asmx";);
    >
    >             call.setEncodingStyle(null);
    >             call.setProperty(Call.SOAPACTION_USE_PROPERTY , new
    > Boolean(true));
    >             call.setProperty(Call.SOAPACTION_URI_PROPERTY,
    >                     " http://www.webservicex.net/GetGeoIP";);
    >             call.setSOAPVersion(SOAPConstants.SOAP11_CONSTANTS);
    >             call.setOperationUse(Use.LITERAL);
    >             call.setOperationStyle(Style.WRAPPED_STR );
    >
    >
    > call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR
    > ,
    >                     Boolean.FALSE);
    >
    > call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
    >                     Boolean.FALSE);
    >
    >             call.setReturnType(new QName(name.getNamespaceURI
    (), "GeoIP"));
    >             call.setReturnClass(Document.class);
    >
    >             call.registerTypeMapping(Document.class,
    >                     new QName(name.getNamespaceURI(), "GeoIP"),
    >                     DocumentSerializerFactory.class,
    >                     DocumentDeserializerFactory.class ,
    >                     false
    >                     );
    >
    >
    >             setRequestHeaders(call);
    >             setAttachments(call);
    >
    >             Object[] params = new Object[] { " 203.244.123.15
    <http://203.244.123.15>" };
    >
    >             Document doc;
    >
    >             doc = (Document) call.invoke(params);
    >
    >             printDocument(doc, resp.getWriter ());
    >
    >         } catch (MalformedURLException e) {
    >             e.printStackTrace();
    >         } catch (ServiceException e) {
    >             e.printStackTrace();
    >         } catch (IOException e) {
    >             e.printStackTrace();
    >         } catch (Exception e) {
    >             e.printStackTrace();
    >         }
    >     }
    >
    >     private void printDocument(Document ret, PrintWriter writer) {
    >         NodeList childNodes = ret.getChildNodes();
    >
    >         for (int i = 0; i < childNodes.getLength(); i++) {
    >             printNode(0, childNodes.item(i), writer);
    >         }
    >     }
    >
    >     private void printNode(int level, Node node, PrintWriter
    writer) {
    >         String pre = "";
    >
    >         for (int i = 0; i < level; i++) {
    >             pre += "\t";
    >         }
    >
    >         String strNode = String.format("%s%s = %s", pre,
    node.getNodeName
    > (),
    >                 node.getNodeValue());
    >
    >         writer.println(strNode);
    >
    >         NodeList childNodes = node.getChildNodes();
    >
    >         for (int i = 0; i < childNodes.getLength(); i++) {
    >             printNode(level++, childNodes.item(i), writer);
    >         }
    >
    >     }
    >
    > }
    >
    
-------------------------------------------------------------------------------------
    > SOAP request being posted (body tabbed for readability)
    >
    > POST http://webservicex.net:80/geoipservice.asmx HTTP/1.0
    > Content-Type: text/xml; charset=utf-8
    > Accept: application/soap+xml, application/dime,
    multipart/related, text/*
    > User-Agent: Axis/1.4
    > Host: webservicex.net <http://webservicex.net>
    > Cache-Control: no-cache
    > Pragma: no-cache
    > SOAPAction: "http://www.webservicex.net/GetGeoIP "
    > Content-length: 354
    >
    > <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
    > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
    <http://schemas.xmlsoap.org/soap/envelope/> "
    > xmlns:xsd="http://www.w3.org/2001/XMLSchema";
    > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
    <http://www.w3.org/2001/XMLSchema-instance> ">
    > <soapenv:Body>
    > <GetGeoIP xmlns="http://www.webservicex.net";>
    > <IPAddress> 203.244.123.15 <http://203.244.123.15></IPAddress>
    > </GetGeoIP>
    > </soapenv:Body>
    > </soapenv:Envelope>
    >
    
--------------------------------------------------------------------------------------
    > SOAP response received (body tabbed for readability)
    >
    > HTTP/1.0 200 OK
    > Date: Tue, 30 Oct 2007 20:05:44 GMT
    > Server: Microsoft-IIS/6.0
    > X-Powered-By: ASP.NET <http://ASP.NET>
    > X-AspNet-Version: 1.1.4322
    > Cache-Control: private, max-age=0
    > Content-Type: text/xml; charset=utf-8
    > Content-length: 524
    > X-Cache: MISS from httpproxy
    > Via: 1.0 httpproxy:3128 (squid)
    > Proxy-Connection: close
    >
    > <?xml version=" 1.0" encoding="utf-8"?>
    > <soap:Envelope
    > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
    > xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance";
    > xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
    > <soap:Body>
    > <GetGeoIPResponse xmlns=" http://www.webservicex.net";>
    > <GetGeoIPResult>
    > <ReturnCode>1</ReturnCode>
    > <IP> 203.244.123.15 <http://203.244.123.15></IP>
    > <ReturnCodeDetails>Record Found</ReturnCodeDetails>
    > <CountryName>KOREA REPUBLIC OF</CountryName>
    > <CountryCode>KR</CountryCode>
    > </GetGeoIPResult>
    > </GetGeoIPResponse>
    > </soap:Body>
    > </soap:Envelope>
    > ---------------------------------------------------------
    > What printDocument() method shows:
    > ns1:ReturnCode = null
    > #text = 1
    >
    >
    > ---------------------------------------------------------
    >
    > Thanks,
    >             Ernesto Pin

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    For additional commands, e-mail: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>




--
Saludos,
Ernesto Pin


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to