Hi Anne,
        Thanks for your response.I am attaching with this mail the HelloWorld 
Service and axis2 client.Its a simple HelloWorld service and I am using end 
point reference to access this service.There is no wsdl for it.

Kind Regards
Kashif Saleem


-----Original Message-----
From: Anne Thomas Manes [mailto:[EMAIL PROTECTED]
Sent: Sat 3/25/2006 3:45 PM
To: [email protected]
Subject: Re: problem in accessing python Hello World Service
 
Please post the WSDL.

Based on the error messages, I'm guessing that the server is not expecting
the

<example1:HelloWorld xmlns:example1="http://example1.org/example1";>

element to appear in the message.

Anne

On 3/24/06, Kashif Saleem <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>        I installed a ZSI 2.0_rc2  on machine geron045.ncl.ac.uk.I run the
> HelloWorld.py service on  the this machine i.e.
> http://geron045.ncl.ac.uk:8088/HelloWorld.py.This service has one
> operation called "HelloWorld" which accepts one argument and return this
> argument.
>
> Then from the another machine i.e "geron007.ncl.ac.uk" I tried to access
> this HelloWorld service which is deployed at
> http://geron045.ncl.ac.uk:8088/HelloWorld.py through AXIS2 client.I got
> the processed failure message.I monitor the soap messages going back and
> forth through TCPMON.The output for this is given below:
>
> Request:
>
> POST /HelloWorld.py HTTP/1.1
>
> User-Agent: Axis/2.0
>
> SOAPAction:
>
> Connection: Keep-Alive
>
> Host: geron045.ncl.ac.uk:8082
>
> Content-Length: 809
>
> 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:8082/HelloWorld.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
> ">0A2F12FAE0A1B8456E11432354035971</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.0 500 Internal error
>
> Server: ZSI/1.1 BaseHTTP/0.3 Python/2.4.2
>
> Date: Fri, 24 Mar 2006 21:21:05 GMT
>
> Content-type: text/xml; charset="utf-8"
>
> Content-Length: 695
>
> <SOAP-ENV:Envelope xmlns:SOAP-ENC="
> http://schemas.xmlsoap.org/soap/encoding/"; xmlns:SOAP-ENV="
> http://schemas.xmlsoap.org/soap/envelope/"; xmlns:ZSI="
> http://www.zolera.com/schemas/ZSI/"; xmlns:xsd="
> http://www.w3.org/2001/XMLSchema"; xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance";>
> <SOAP-ENV:Header>
> </SOAP-ENV:Header>
> <SOAP-ENV:Body>
> <SOAP-ENV:Fault>
> <faultcode>SOAP-ENV:Server
> </faultcode>
> <faultstring>Processing Failure</faultstring><detail><ZSI:FaultDetail>
> <ZSI:string>exceptions:TypeError
> Expecting typecode in result
> </ZSI:string>
>
> <ZSI:trace>/usr/lib/python2.4/site-packages/ZSI/dispatch.py:69:_Dispatch</ZSI:trace></ZSI:FaultDetail>
> </detail>
> </SOAP-ENV:Fault>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> Just to clarify things further.I did one more thing,I removed the argument
> for the HelloWorld operation so now it is accepting no argument.And now
> when I tried to access the same service.I got the error  again.Bymonitoring 
> the soap messages going back and forth through
> TCPMON.This type the error changes to something else as given below:
>
>
> Request:
>
> POST /HelloWorld.py HTTP/1.1
>
> User-Agent: Axis/2.0
>
> SOAPAction:
>
> Connection: Keep-Alive
>
> Host: geron045.ncl.ac.uk:8082
>
> Content-Length: 740
>
> 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:8082/HelloWorld.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
> ">C1EB5D8FA2D3E2ABE811432360408471</wsa:MessageID>
> </soapenv:Header>
> <soapenv:Body>
> <example1:HelloWorld xmlns:example1="http://example1.org/example1"; />
> </soapenv:Body>
> </soapenv:Envelope>
>
>
> Response:
>
> HTTP/1.0 500 Internal error
>
> Server: ZSI/1.1 BaseHTTP/0.3 Python/2.4.2
>
> Date: Fri, 24 Mar 2006 21:31:42 GMT
>
> Content-type: text/xml; charset="utf-8"
>
> Content-Length: 708
>
>
> <SOAP-ENV:Envelope xmlns:SOAP-ENC="
> http://schemas.xmlsoap.org/soap/encoding/"; xmlns:SOAP-ENV="
> http://schemas.xmlsoap.org/soap/envelope/"; xmlns:ZSI="
> http://www.zolera.com/schemas/ZSI/"; xmlns:xsd="
> http://www.w3.org/2001/XMLSchema"; xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance";>
> <SOAP-ENV:Header>
> </SOAP-ENV:Header>
> <SOAP-ENV:Body>
> <SOAP-ENV:Fault>
> <faultcode>SOAP-ENV:Server</faultcode>
> <faultstring>Processing Failure</faultstring>
> <detail>
> <ZSI:FaultDetail>
> <ZSI:string>exceptions:TypeError
> HelloWorld() takes no arguments (1 given)
> </ZSI:string>
> <ZSI:trace>/usr/lib/python2.4/site-packages/ZSI/dispatch.py:67:_Dispatch
> </ZSI:trace>
> </ZSI:FaultDetail>
> </detail>
> </SOAP-ENV:Fault>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
>
> I am quite surprised by these errors.I am attaching with this mail my
> HelloWorld.py service and AXIS2 client code.I would appreciate if some guy
> would explain me the strange behavior of this simple scenario.
>
>
> Kind Regards
> Kashif Saleem
>
>
>
>
>
>



Attachment: HelloWorld.py
Description: HelloWorld.py

/*
 * 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();
        }        
    }
}
/*
 * 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;
    }


}

Reply via email to