Using PHP SoapClient with Java JAX-WS RI (Webservice)

Posted by Kau-Boy on Stack Overflow See other posts from Stack Overflow or by Kau-Boy
Published on 2010-05-27T20:38:06Z Indexed on 2010/05/27 20:41 UTC
Read the original article Hit count: 386

Filed under:
|
|

For a new project, we want to build a web service in JAVA using JAX-WS RI and for the web service client, we want to use PHP.

In a small tutorial about JAX-WS RI I found this example web service:

package webservice;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;

@WebService
@SOAPBinding(style = Style.RPC)
public class Calculator {
    public long addValues(int val1, int val2) {
        return val1 + val2;
    }
}

and for the web server:

package webservice;

import javax.xml.ws.Endpoint;
import webservice.Calculator;

public class CalculatorServer {
    public static void main(String args[]) {
        Calculator server = new Calculator();
        Endpoint endpoint = Endpoint.publish("http://localhost:8080/calculator", server);
    }
}

Starting the Server and browsing the WDSL with the URL "http://localhost:8080/calculator?wsdl" works perfectly. But calling the web service from PHP fails

My very simple PHP call looks like this:

$client = new SoapClient('http://localhost:8080/calculator?wsdl', array('trace' => 1));
echo 'Sum: '.$client->addValues(4, 5);

But than I either get a "Fatal error: Maximum execution time of 60 seconds exceeded..." or a "Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost:8080/calculator?wsdl' ..." exception.

I have tested the PHP SoapClient() with other web services and they work without any issues. Is there a known issue with JAX-WS RI in comibation with PHP, or is there an error in my web service I didn't see?

I have found this bug report, but even updating to PHP 5.3.2 doesn't solved the problem.

Can anyone tell me what to do? And by the way, my java version running on Windows 7 x64 is the following:

java version "1.6.0_17" Java(TM) SE Runtime Environment (build 1.6.0_17-b04) Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)

© Stack Overflow or respective owner

Related posts about java

Related posts about php