Hi,
I'm trying to use Apache SOAP-RPC to write a client that invokes a web 
service that was developed and deployed under WSDP.  I have a WSDL doc
generated under WSDP for this web service and the web.xml deployment
descriptor.  Following several Apache SOAP-RPC client code samples,
I wrote the AddIntsClient.java below.  

I get the Fault Code "env:Server" w/ FaultString = "Internal server error
(class com.sun.xml.rpc.soap.streaming.SOAPProtocolViolationException)". I
tried several strings passed into the Call method setTargetObjectURI()
seeing that WSDP's xml docs do not use a 'urn' entry.  No luck.  Dunno if
this is the cause of the error.

I was hoping that someone was able to invoke a WSDP web service from
an Apache SOAP-RPC client and could shed some light on this or provide
a sample code snippet.

Thanks for any help anyone can offer, 
Marc
______________________________________________________
MY WSDL:

<?xml version="1.0" encoding="UTF-8"?>

<definitions name="IntegerAdditionService" targetNamespace="http://addints.org/wsdl";
 xmlns:tns="http://addints.org/wsdl"; xmlns="http://schemas.xmlsoap.org/wsdl/"; xmlns:
xsd="http://www.w3.org/2001/XMLSchema"; xmlns:soap="http://schemas.xmlsoap.org/wsdl/s
oap/">
  <types/>
  <message name="getSum">
    <part name="int_1" type="xsd:int"/>
    <part name="int_2" type="xsd:int"/></message>
  <message name="getSumResponse">
    <part name="result" type="xsd:int"/></message>
  <portType name="AddIntsIFPortType">
    <operation name="getSum">
      <input message="tns:getSum"/>
      <output message="tns:getSumResponse"/></operation></portType>
  <binding name="AddIntsIFBinding" type="tns:AddIntsIFPortType">
    <operation name="getSum">
      <input>
        <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; use="en
coded" namespace="http://addints.org/wsdl"/></input>
      <output>
        <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; use="en
coded" namespace="http://addints.org/wsdl"/></output>
      <soap:operation soapAction=""/></operation>
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"; style="rpc"/></bi
nding>
  <service name="IntegerAddition">
    <port name="AddIntsIFPort" binding="tns:AddIntsIFBinding">
      <soap:address
location="http://myhost.lbl.gov:8080/jaxrpc-addints/jaxrpc/AddIntsIF"/></port></service>
</definitions>
_______________________________________________

MY CLIENT:

import org.apache.soap.util.xml.*;
import org.apache.soap.rpc.*;
import org.apache.soap.*;
import java.util.Vector;
import java.net.URL;

public class AddIntsClient {

   public static void main(String[] args)
   {
        Response r = null;
        Call c = new Call();
        Vector parameters = new Vector();

        /*****   SAME ERROR W/ EVERY c.setTargetObjectURI param BELOW  *****/

        //c.setTargetObjectURI("urn:xml-soap-addints-demo");
        c.setTargetObjectURI("IntegerAdditionService");
        //c.setTargetObjectURI("IntegerAddition");
        //c.setTargetObjectURI("JAXRPCEndpoint");
        //c.setTargetObjectURI("Integer Addition Application");
        //c.setTargetObjectURI("http://scooby.lbl.gov:8080/jaxrpc-addints/jaxrpc/Ad
dIntsIF");
        c.setMethodName("getSum");
        c.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
        parameters.addElement(new Parameter("x", Integer.class, args[0], null));
        parameters.addElement(new Parameter("y", Integer.class, args[1], null));
        c.setParams(parameters);

        try {
            /*r = c.invoke(
              new URL("http://myhost.lbl.gov:8080/soap/servlet/rpcrouter";), "");
            */

            // Using URL="http://myhost.lbl.gov:8080/jaxrpc-addints"; and letting
            // the web.xml deployment descriptor figure this out doesn't work either.
            r = c.invoke(
                new URL("http://myhost.lbl.gov:8080/jaxrpc-addints/jaxrpc/AddIntsIF
"), "");

        } catch(Exception e) {
                System.out.println("Error for c.invoke(): ");
                e.printStackTrace(); }

        if (r.generatedFault())
        {
            Fault f = r.getFault();
            System.out.println("Error Occurred: ");
            System.out.println(" Fault Code = " + f.getFaultCode());
            System.out.println(" FaultString = " + f.getFaultString());
        }
        else
        {
            Parameter result = r.getReturnValue();
            System.out.println(args[0] + " + " + args[1] + " = " + result.getValue(
));
        }
   }
}

----------------------------------------------------------------
Marc Perry                              [EMAIL PROTECTED]
Lawrence Berkeley National Laboratory   WORK#  (510) 486-6786
1 Cyclotron Road                        FAX#   (510) 486-6363
Berkeley, CA 94720                      MS: 50A-3111

Reply via email to