1

I want to connect to a web service in a SSL connection. I connect to it and I get Service and Port but when I send Requests, it just returns null.

I searched the web but I could not understand what is the problem. may be because it is SSL, I need to connect it different as an Http connection, is it true?

I used auto code generators, they return null too, WireShark says that SSL Packages transmitted correctly but I cannot read the SOAP from these packages because they are SSL.

I test the web service with some applications and the tools and got correct answers from them.

Question:

  • is it possible that the null value is because SSL connection?
  • what mistakes could make this null returning?
  • How can I see the SOAP messeges I send and I get?

Here is My Java Code:

public class WS_TheServeice
{
    private static QName qname;
    private static URL url;
    private static Service service;
    private static ImplementationServicePortType sender;
    static
    {
        qname = new QName("http://wservice.com/", "ImplementationService");
        try
        {
            url = new URL("https://to-service?wsdl");
        }
        catch (MalformedURLException e)
        {
            e.printStackTrace();
        }
        service = Service.create(url, qname);
        sender = service.getPort(ImplementationServicePortType.class);
    }

    public static boolean PayToAcceptor(int AcceptorID, int Kipa) throws Exception
    {
        getUserInfo req = new getUserInfo();
        req.zpID = AcceptorID;
        req.kipa = Kipa;
        getUserInfoResponse user_info = new getUserInfoResponse();//user_info is not NULL here
        user_info = sender.getUserInfo(req);//But web server makes it NULL
        if (user_info!=null) //// ---- HERE, IT Always return NULL
        {
            System.out.println("YouWon");
            return true;
        }
        else
        {
            System.out.println("YouLoose");
            return false;

        }
    }

    public static void main(String Args[]) throws Exception
    {
        PayToAcceptor(12345, 1);
    }
}

thanks.

Behnam Safari
  • 2,941
  • 6
  • 27
  • 42

1 Answers1

1

Did you figure out how to do this? I've had similar problems in the past..

Did you try this: SSL Connection for consuming web services ?

Community
  • 1
  • 1
Max
  • 639
  • 2
  • 6
  • 19