Hi Don,
A couple things
- you're using the dynamic client below. The constructor you're using is
expecting a url to the wsdl, not for the service itself. Try appending
"?wsdl".
- You probably don't want to be using the dynamic client as that won't
work with your xmlbeans classes most likely.This line should work though:
client2 = (TestService) proxyFactory.create(serviceModel,
"http://localhost:8191/TestService");
- If you're having problems with the above can you up the log output
levels to DEBUG? (see the log4j manual if you need to learn how to do
this). There is probably an exception being thrown on the server side
that should give you some idea of whats happening.
Cheers,
- Dan
Don Stewart wrote:
Hi,
Is there a full example of client & server for Xmlbeans using the
embedded XfireHttpServer and the dynamic client ?
I have the server and client built but just keep getting an XFire
Fault which does not identify what the issue is other than I keep
getting an HTTP 500 error from the client.
Manually accessing the server URL gives me a HTML page containing
'Invalid SOAP request'.
There is no WSDL available either at the
http://host:port/TestService?wsdl, however Telnet shows the port is
open as does the 'Invalid SOAP request'. The server code is:-
public class TestServer {
/**
* @param args
*/
public static void main(String[] args) {
XFire xfire = XFireFactory.newInstance().getXFire();
XmlBeansServiceFactory factory = new
XmlBeansServiceFactory(xfire.getTransportManager());
Service service = factory.create(TestService.class);
service.setProperty(XmlBeansType.XMLBEANS_NAMESPACE_HACK, "true");
xfire.getServiceRegistry().register(service);
XFireHttpServer server = new XFireHttpServer();
server.setPort(8191);
try {
server.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}
whilst the client is :-
// Create a service model for the client
XmlBeansServiceFactory serviceFactory = new XmlBeansServiceFactory();
Service serviceModel = serviceFactory.create(TestService.class);
// Create a client proxy
XFireProxyFactory proxyFactory = new XFireProxyFactory();
try {
client = new Client(new URL("http://localhost:8191/TestService"));
//client2 = (TestService) proxyFactory.create(serviceModel,
"http://localhost:8191/TestService");
the HTTP 500 occurs on the line client = new Client(new
URL("http://localhost:8191/TestService"));
Any help would be much appreciated.
Regards
Don
--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com
http://netzooid.com/blog