Hi Eran,
        I found out that I can access the python services without any problem 
which does not contain input arguments.So the problem occurs only if webservice 
needs some input arguments.As I understood ZSI cant understand the way input 
argument send by the AXIS2 and as a result it gives fault message "unparsable 
messages" as mentioned in the below email.Any thoughts on it would highly be 
regarded.Thanks.


Kind Regards
Kashif Saleem




-----Original Message-----
From: Kashif Saleem
Sent: Wed 22/03/2006 18:01
To: [email protected]
Cc: [EMAIL PROTECTED]
Subject: RE-[Axis2] Problem in accessing the python service
 
Hi Eran,
       I fixed the dispatching logic on the server.Now when I tried to access 
the server helloWorld  operation.I got the unparsable message.I  used to 
TCPMonitor to look at the soap request and response messages.Below is the 
tcpmonitor output:
Request:

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



<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing";><soapenv:Header><wsa:To
 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing";>http://localhost:8080/web-services/kashif.py</wsa:To><wsa:ReplyTo
 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing";><wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address></wsa:ReplyTo><wsa:MessageID
 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing";>C97E1B4CD42952985E11430494666231</wsa:MessageID></soapenv:Header><soapenv:Body><example1:helloWorld
 xmlns:example1="http://example1.org/example1";><example1:Text>Axis2 Echo String 
</example1:Text></example1:helloWorld></soapenv:Body></soapenv:Envelope>


Response:

HTTP/1.1 200 OK

Date: Wed, 22 Mar 2006 17:42:07 GMT

Server: Apache/1.3.33 (Debian GNU/Linux) mod_python/2.7.10 Python/2.3.4 
mod_fastcgi/2.4.2 mod_ssl/2.8.22 OpenSSL/0.9.7e

Keep-Alive: timeout=15, max=100

Connection: Keep-Alive

Transfer-Encoding: chunked

Content-Type: text/xml



318

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xmlns:xsd="http://www.w3.org/2001/XMLSchema";
  xmlns:ZSI="http://www.zolera.com/schemas/ZSI/"; 
  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; >
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Unparseable message</faultstring>
<detail>
<ZSI:ParseFaultDetail>
<ZSI:string>Any cannot parse untyped element</ZSI:string>
<ZSI:trace>/soapenv:Envelope/soapenv:Body/example1:helloWorld/example1:Text</ZSI:trace>
</ZSI:ParseFaultDetail>

</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>



I checked the server error log but there is no error log for it.Attached with 
this mail is my ClientUtil.java and TestClient.java.Any help would highly be 
appreciated.


Kind Regards
Kashif Saleem


-----Original Message-----
From: Eran Chinthaka [mailto:[EMAIL PROTECTED]
Sent: Tue 21/03/2006 17:43
To: [email protected]
Subject: Re: [Axis2] Problem in accessing the python service
 
Kashif Saleem wrote:
> Hi Eran,
>         I updated to newest version.Now again I am getting the server error- 
> even after setting the options.setProperty(MessageContextConstants.CHUNKED, 
> Constants.VALUE_FALSE).I checked the server log this time it is showing the 
> following messages:
>   
Can you check on the server log please. I just accessed the service at 
your endpoint, and followings are the requests and reponses.

If I understand correct, this message has confused your dispatching 
logic in the server.

-- Chinthaka

Request :

POST /web-services/sbml.py HTTP/1.1
User-Agent: Axis/2.0
SOAPAction: ""
Connection: Keep-Alive
Host: www.basis.ncl.ac.uk
Content-Length: 286
Content-Type: text/xml; charset=UTF-8
 
<?xml version='1.0' encoding='UTF-8'?>
   <soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
      <soapenv:Header />
      <soapenv:Body>
         <example1:helloWorld xmlns:example1="http://example1.org/example1";>
            <example1:Text />
         </example1:helloWorld>
      </soapenv:Body>
   </soapenv:Envelope>

Reponse :

HTTP/1.1 200 OK
Date: Tue, 21 Mar 2006 17:39:29 GMT
Server: Apache/1.3.33 (Debian GNU/Linux) mod_python/2.7.10 Python/2.3.4 
mod_fastcgi/2.4.2 mod_ssl/2.8.22 OpenSSL/0.9.7e
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/xml
 
360
<?xml version="1.0" encoding="utf-8"?>
   <SOAP-ENV:Envelope  
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";  
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";  
xmlns:xsd="http://www.w3.org/2001/XMLSchema";  
xmlns:ZSI="http://www.zolera.com/schemas/ZSI/";   
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; >
      <SOAP-ENV:Body>
         <SOAP-ENV:Fault>
            <faultcode>SOAP-ENV:Server</faultcode>
            <faultstring>Processing Failure</faultstring>
            <detail>
               <ZSI:FaultDetail>
                  <ZSI:string>Multiple implementations found: 
[&lt;function helloWorld at 0x4144379c>, &lt;function helloWorld at 
0x4147ddbc>]</ZSI:string>
                  
<ZSI:trace>/home/basis/pythonModules//lib/python/ZSI/dispatch.py:44:_Dispatch</ZSI:trace>
               </ZSI:FaultDetail>
            </detail>
         </SOAP-ENV:Fault>
      </SOAP-ENV:Body>
   </SOAP-ENV:Envelope>0






/*
 * Copyright 2004,2005 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package userguide.clients;

import org.apache.axis2.om.OMAbstractFactory;
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMFactory;
import org.apache.axis2.om.OMNamespace;
import java.io.*;

public class ClientUtil {

    public static OMElement getEchoOMElement() {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace(
                "http://example1.org/example1";, "example1");
        OMElement method = fac.createOMElement("echo", omNs);
        OMElement value = fac.createOMElement("Text", omNs);
        value.addChild(fac.createText(value, "Axis2 Echo String "));
        method.addChild(value);

        return method;
    }
    public static OMElement getValidateOMElement() {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace(
                "http://example1.org/example1";, "example1");
     OMElement method = fac.createOMElement("validate", omNs);
       String sbml=readFile("/home/nks34/Desktop/softwares/axis2/samples/userguide/src/userguide/clients/sbmlmodel.xml");
    System.out.println("I read it"+sbml);
        OMElement value = fac.createOMElement(sbml, omNs);
//	System.out.println("I read it");
//        value.addChild(fac.createText(value, "Axis2 Echo String "));
        method.addChild(value);
        return method;
    }
   public static OMElement getHelloOMElement() {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace(
                "http://example1.org/example1";, "example1");
     OMElement method = fac.createOMElement("helloWorld", omNs);
/*       String sbml=readFile("/home/nks34/Desktop/softwares/axis2/samples/userguide/src/userguide/clients/sbmlmodel.xml");*/
        OMElement value = fac.createOMElement("Text", omNs);
       value.addChild(fac.createText(value,"Axis2 Echo String "));
        method.addChild(value);

        return method;
    }
  public static OMElement getCreateUserOMElement() {
	  OMFactory fac=OMAbstractFactory.getOMFactory();
	  OMNamespace omNs=fac.createOMNamespace("http://example1.org/example1";, "example1");
	  OMElement method = fac.createOMElement("createUser", omNs);
	  OMElement value = fac.createOMElement("tom786", omNs);
	  value.addChild(fac.createText(value, "[EMAIL PROTECTED]"));
	  method.addChild(value);
          return method;		    
  }
  public static OMElement getHelloWorldOMElement(){
	  OMFactory fac=OMAbstractFactory.getOMFactory();
	  OMNamespace omNs=fac.createOMNamespace("http://example1.org/example1";, "example1");
	  OMElement method = fac.createOMElement("helloWorld", omNs);
	  OMElement value = fac.createOMElement("Hello How r U", omNs);
	   method.addChild(value);
	   return method;		     
  }
  public static  String readFile(String file)
   {
   String sbml="";
        try {
        BufferedReader in = new BufferedReader(new FileReader(file));
        String str;
        while ((str = in.readLine()) != null) {
            sbml+=str;
        }
        in.close();
    } catch (IOException e) {
    }
return sbml;
   }




    public static OMElement getPingOMElement() {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace(
                "http://example1.org/example1";, "example1");
        OMElement method = fac.createOMElement("ping", omNs);
        OMElement value = fac.createOMElement("Text", omNs);
        value.addChild(fac.createText(value, "Axis2 Ping String "));
        method.addChild(value);

        return method;
    }


}
/*
 * Copyright 2004,2005 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package userguide.clients;

import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.context.*;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.om.OMElement;

import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import java.io.StringWriter;

/**
 * Sample for synchronous single channel blocking service invocation.
 * Message Exchage Pattern IN-OUT
 */
public class TestClient {
    	
//private static EndpointReference targetEPR = new  EndpointReference("http://www.basis.ncl.ac.uk/web-services/kashif.py";);
private static EndpointReference targetEPR = new  EndpointReference("http://localhost:8080/web-services/kashif.py";);

    public static void main(String[] args) {
        try {   
   /*     java.net.URL  endpoint = new java.net.URL("http://www.basis.ncl.ac.uk/web-services/sbml.py";);
       EndpointReference targetEPR = new EndpointReference(targetEPR);*/

//        OMElement payload = ClientUtil.getCreateUserOMElement();
        OMElement payload = ClientUtil.getHelloOMElement();
           Options options = new Options();
            options.setTo(targetEPR);
	    options.setProperty(MessageContextConstants.CHUNKED, Constants.VALUE_FALSE);
	  	    
            options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
            //Blocking invocation
            ServiceClient sender = new ServiceClient();
            sender.setOptions(options);
            OMElement result = sender.sendReceive(payload);
            System.out.println("I got the result");
	    
            StringWriter writer = new StringWriter();
            result.serialize(XMLOutputFactory.newInstance()
                    .createXMLStreamWriter(writer));
            writer.flush();

            System.out.println(writer.toString());

        } catch (AxisFault axisFault) {
		System.out.println("I am in axis fault");
            axisFault.printStackTrace();
        } catch (XMLStreamException e) {
            e.printStackTrace();
        }
        

    }
}

Reply via email to