You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by giuseppe nocente <gn...@gmail.com> on 2006/04/10 17:00:52 UTC

SSL and Web Service

There is anyone that help me to understand the problem that i have whel y
execute
my client.

Java Client

import java.net.URL;

import javax.xml.rpc.ParameterMode;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;

public class clientMatematicaSSL

{
    public static void main(String[] args) throws Exception {

        System
                .setProperty(
                        "javax.net.ssl.keyStore",
                        "C:\\Programmi\\Apache_Software_Foundation\\Tomcat
5.5.16\\keystore\\keystoreclient.jks");

        System.setProperty("javax.net.ssl.keyStorePassword", "changeit");

        System
                .setProperty(
                        "javax.net.ssl.trustStore",
                        "C:\\Programmi\\Apache_Software_Foundation\\Tomcat
5.5.16\\keystore\\cacerts.jks");

        System.setProperty("javax.net.ssl.trustStorePassword", "changeit");

        Integer numero = new Integer(args[0]);
        String nameWS = "http://localhost:8443/axis/matematica.jws";
        URL endPointWS = new URL(nameWS);
        // inizializzazione WS

        Service service = new Service();
        Call call = (Call) service.createCall();
        call.removeAllParameters();

        // configurazione parametri WS

        call.setTargetEndpointAddress(endPointWS);
        call.addParameter("numero", XMLType.XSD_INT, ParameterMode.IN);
        call.setOperationName("pari");
        call.setReturnType(XMLType.XSD_STRING);

        // invocazione WS

        String risultato = (String) call.invoke(new Object[] { numero });

        //

        System.out.println("Il numero " + numero + " e' " + risultato);

        //

    }

}


This is the error that return me when i execute the java code

Exception in thread "main" AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: java.lang.NumberFormatException: For input string:
&quot;&quot;
 faultActor:
 faultNode:
 faultDetail:
    {http://xml.apache.org/axis/}stackTrace:java.lang.NumberFormatException:
For input string: &quot;&quot;
    at java.lang.NumberFormatException.forInputString(
NumberFormatException.java:48)
    at java.lang.Integer.parseInt(Integer.java:468)
    at java.lang.Integer.parseInt(Integer.java:497)
    at org.apache.axis.transport.http.HTTPSender.readHeadersFromSocket(
HTTPSender.java:640)
    at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:143)
    at org.apache.axis.strategies.InvocationStrategy.visit(
InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
    at org.apache.axis.client.Call.invoke(Call.java:2767)
    at org.apache.axis.client.Call.invoke(Call.java:2443)
    at org.apache.axis.client.Call.invoke(Call.java:2366)
    at org.apache.axis.client.Call.invoke(Call.java:1812)
    at clientMatematicaSSL.main(clientMatematicaSSL.java:46)

    {http://xml.apache.org/axis/}hostname:mediacon-91110f

java.lang.NumberFormatException: For input string: ""
    at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
    at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:154)
    at org.apache.axis.strategies.InvocationStrategy.visit(
InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
    at org.apache.axis.client.Call.invoke(Call.java:2767)
    at org.apache.axis.client.Call.invoke(Call.java:2443)
    at org.apache.axis.client.Call.invoke(Call.java:2366)
    at org.apache.axis.client.Call.invoke(Call.java:1812)
    at clientMatematicaSSL.main(clientMatematicaSSL.java:46)
Caused by: java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(
NumberFormatException.java:48)
    at java.lang.Integer.parseInt(Integer.java:468)
    at java.lang.Integer.parseInt(Integer.java:497)
    at org.apache.axis.transport.http.HTTPSender.readHeadersFromSocket(
HTTPSender.java:640)
    at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:143)
    ... 10 more

thancks

Giuseppe

Re: SSL and Web Service

Posted by giuseppe nocente <gn...@gmail.com>.
I have solve my problem, thancks at all
the problem is into the url : "http://localhost:8443/axis/matematica.jws";
instand to "https://localhost:8443/axis/matematica.jws<http://localhost:8443/axis/matematica.jws>
";

By

Giuseppe

On 4/10/06, giuseppe nocente <gn...@gmail.com> wrote:
>
> There is anyone that help me to understand the problem that i have whel y
> execute
> my client.
>
> Java Client
>
> import java.net.URL;
>
> import javax.xml.rpc.ParameterMode;
>
> import org.apache.axis.client.Call ;
> import org.apache.axis.client.Service;
> import org.apache.axis.encoding.XMLType;
>
> public class clientMatematicaSSL
>
> {
>     public static void main(String[] args) throws Exception {
>
>         System
>                 .setProperty(
>                         "javax.net.ssl.keyStore",
>                         "C:\\Programmi\\Apache_Software_Foundation\\Tomcat
> 5.5.16\\keystore\\keystoreclient.jks");
>
>         System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
>
>         System
>                 .setProperty(
>                         "javax.net.ssl.trustStore",
>                         "C:\\Programmi\\Apache_Software_Foundation\\Tomcat
> 5.5.16\\keystore\\cacerts.jks");
>
>         System.setProperty("javax.net.ssl.trustStorePassword",
> "changeit");
>
>         Integer numero = new Integer(args[0]);
>         String nameWS = "http://localhost:8443/axis/matematica.jws";
>         URL endPointWS = new URL(nameWS);
>         // inizializzazione WS
>
>         Service service = new Service();
>         Call call = (Call) service.createCall();
>         call.removeAllParameters();
>
>         // configurazione parametri WS
>
>         call.setTargetEndpointAddress(endPointWS);
>         call.addParameter("numero", XMLType.XSD_INT, ParameterMode.IN);
>         call.setOperationName("pari");
>         call.setReturnType (XMLType.XSD_STRING);
>
>         // invocazione WS
>
>         String risultato = (String) call.invoke(new Object[] { numero });
>
>         //
>
>         System.out.println("Il numero " + numero + " e' " + risultato);
>
>         //
>
>     }
>
> }
>
>
> This is the error that return me when i execute the java code
>
> Exception in thread "main" AxisFault
>  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException<http://schemas.xmlsoap.org/soap/envelope/%7DServer.userException>
>  faultSubcode:
>  faultString: java.lang.NumberFormatException: For input string:
> &quot;&quot;
>  faultActor:
>  faultNode:
>  faultDetail:
>     {
> http://xml.apache.org/axis/}stackTrace:java.lang.NumberFormatException<http://xml.apache.org/axis/%7DstackTrace:java.lang.NumberFormatException>:
> For input string: &quot;&quot;
>     at java.lang.NumberFormatException.forInputString (
> NumberFormatException.java:48)
>     at java.lang.Integer.parseInt(Integer.java:468)
>     at java.lang.Integer.parseInt(Integer.java:497)
>     at org.apache.axis.transport.http.HTTPSender.readHeadersFromSocket(
> HTTPSender.java :640)
>     at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java
> :143)
>     at org.apache.axis.strategies.InvocationStrategy.visit(
> InvocationStrategy.java:32)
>     at org.apache.axis.SimpleChain.doVisiting (SimpleChain.java:118)
>     at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
>     at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
>     at org.apache.axis.client.Call.invokeEngine(Call.java :2784)
>     at org.apache.axis.client.Call.invoke(Call.java:2767)
>     at org.apache.axis.client.Call.invoke(Call.java:2443)
>     at org.apache.axis.client.Call.invoke(Call.java:2366)
>     at org.apache.axis.client.Call.invoke (Call.java:1812)
>     at clientMatematicaSSL.main(clientMatematicaSSL.java:46)
>
>     {http://xml.apache.org/axis/}hostname:mediacon-91110f<http://xml.apache.org/axis/%7Dhostname:mediacon-91110f>
>
> java.lang.NumberFormatException : For input string: ""
>     at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
>     at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java
> :154)
>     at org.apache.axis.strategies.InvocationStrategy.visit (
> InvocationStrategy.java:32)
>     at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
>     at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
>     at org.apache.axis.client.AxisClient.invoke(AxisClient.java :165)
>     at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
>     at org.apache.axis.client.Call.invoke(Call.java:2767)
>     at org.apache.axis.client.Call.invoke(Call.java:2443)
>     at org.apache.axis.client.Call.invoke (Call.java:2366)
>     at org.apache.axis.client.Call.invoke(Call.java:1812)
>     at clientMatematicaSSL.main(clientMatematicaSSL.java:46)
> Caused by: java.lang.NumberFormatException: For input string: ""
>     at java.lang.NumberFormatException.forInputString(
> NumberFormatException.java:48)
>     at java.lang.Integer.parseInt(Integer.java:468)
>     at java.lang.Integer.parseInt(Integer.java:497)
>     at org.apache.axis.transport.http.HTTPSender.readHeadersFromSocket (
> HTTPSender.java:640)
>     at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java
> :143)
>     ... 10 more
>
> thancks
>
> Giuseppe
>