users@jax-rpc.java.net

Re: dynamic Proxy Client!

From: Oancea Daniel <doancea_at_gmail.com>
Date: Sat, 12 Nov 2005 16:29:15 +0000

I agree with you, but it seams that isn't able to find my operation name.
The question is why?
"raiseAlarm" is an operation defined in the WSDL namespace. Sow, when I put
the WSDL namespase I got the error regarding the fact that doesn't find this
operation. I can not use schema namespace because operation doesn't belong
to this.
Here it is something that I don't understand!
Any suggestion?

Here is my entire client code. Is very simple one:
---------------------------------------------
package client;

import java.net.MalformedURLException;
import java.net.URL;

import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceException;
import javax.xml.rpc.ServiceFactory;


public class SOAPClient_old {

//create a SOAP client using Dynamic Proxy Client.

private static String serviceName = "MonitorSvcService";
private static String qPortName = "MonitorSvcPort";
private static String url = "http://localhost:8081/MonitorSvc/Alarm";
private static String uriName = "http://www.test.com/MonitorSvc.wsdl";


public static void main(String[] args) {

StringBuffer buffer = new StringBuffer(url);
buffer.append("?WSDL");

try {
URL wsdlURL = new URL(buffer.toString());
ServiceFactory factory = ServiceFactory.newInstance();
QName qName = new QName(uriName,serviceName);
Service service = factory.createService(wsdlURL,qName);
MonitorSvc myproxy = (MonitorSvc)service.getPort(new
QName(uriName,qPortName),MonitorSvc.class);
Long id = new Long("234");
float d = (float) 23.0;
myproxy.raiseAlarm(id,"test",d,"test1");


} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}


}
-------------------------------------------------------
Daniel

On 11/12/05, Anne Thomas Manes <atmanes_at_gmail.com> wrote:
>
> Your WSDL namespace is different from your schema namespace. When
> referencing entities from the WSDL, you must use the WSDL namespace. When
> referencing entities from your schema, you must use the schema namespace.
>
> Anne
>
> On 11/11/05, Oancea Daniel <doancea_at_gmail.com> wrote:
> >
> > Hi Anne,
> >
> > I alter the code on your suggestion and I got the following error
> > message:
> >
> > Exception in thread "main" could not find service: {
> > http://www.test.com/MonitorSvc.xsd1}MonitorSvcService<http://www.test.com/MonitorSvc.xsd1%7DMonitorSvcService>in the specified WSDL file. The service names found were: {
> > http://www.test.com/MonitorSvc.wsdl}MonitorSvcService<http://www.test.com/MonitorSvc.wsdl%7DMonitorSvcService>
> > at com.sun.xml.rpc.client.dii.ServiceInfoBuilder.buildServiceInfo(
> > ServiceInfoBuilder.java:108)
> > at com.sun.xml.rpc.client.dii.ConfiguredService.<init>(
> > ConfiguredService.java:62)
> > at com.sun.xml.rpc.client.dii.ConfiguredService.<init>(
> > ConfiguredService.java:48)
> > at com.sun.xml.rpc.client.ServiceFactoryImpl.createService(
> > ServiceFactoryImpl.java:41)
> > at enthrone.dispatcher.snmpMonitor.SOAPClient.main(SOAPClient.java:33)
> >
> >
> > On 11/10/05, Anne Thomas Manes <atmanes_at_gmail.com > wrote:
> > >
> > > I suspect that the correct namespace is
> > > "http://www.test.com/MonitorSvc.xsd1"
> > >
> > > Anne
> > >
> > > On 11/10/05, Anne Thomas Manes < atmanes_at_gmail.com> wrote:
> > > >
> > > > What is the targetNamespace of your schema in the <types> section?
> > > > Is it the same as the WSDL tagetNamespace?
> > > >
> > > > The namespace in your message will be taken from the schema, not
> > > > from the WSDL.
> > > >
> > > > Anne
> > > >
> > > > On 11/10/05, Oancea Daniel < doancea_at_gmail.com> wrote:
> > > > >
> > > > > Thanks Anne for your reply.
> > > > >
> > > > > I think I'm using the right one! Here is another snippet from my
> > > > > description:
> > > > >
> > > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > > <wsdl:definitions
> > > > > name="MonitorSvc"
> > > > > targetNamespace="http://www.test.com/MonitorSvc.wsdl"
> > > > > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> > > > > xmlns:tns="http://www.test.com/MonitorSvc.wsdl"
> > > > > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> > > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > > > > xmlns:xsd1="http://www.test.com/MonitorSvc.xsd1">
> > > > > .............................................................
> > > > >
> > > > > In my client I put something like:
> > > > >
> > > > > ....................................
> > > > >
> > > > > private static String serviceName = "MonitorSvcService";
> > > > > private static String qPortName = "MonitorSvcPort";
> > > > > private static String url = "
> > > > > http://localhost:8081/MonitorSvc/Alarm";
> > > > > private static String uriName = "
> > > > > http://www.test.com/MonitorSvc.wsdl";
> > > > >
> > > > > public static void main(String[] args) {
> > > > >
> > > > > StringBuffer buffer = new StringBuffer(url);
> > > > > buffer.append("?WSDL");
> > > > >
> > > > > try {
> > > > > URL wsdlURL = new URL(buffer.toString());
> > > > > ServiceFactory factory = ServiceFactory.newInstance();
> > > > > QName qName = new QName(uriName,serviceName);
> > > > > Service service = factory.createService(wsdlURL,qName);
> > > > > MonitorSvc myproxy = (MonitorSvc)service.getPort(new
> > > > > QName(uriName,qPortName),MonitorSvc.class);
> > > > > .............................................
> > > > >
> > > > > The SEI it was generated using the -import option in wscompile
> > > > > tool:
> > > > > wscompile -import -d . -nd . -f:norpcstructures config-wsdl.xml
> > > > >
> > > > > Something is wrong but I can not figure what it is.
> > > > >
> > > > >
> > > > > On 11/9/05, Anne Thomas Manes <atmanes_at_gmail.com > wrote:
> > > > > >
> > > > > > Are you sure you're using the correct namespace?
> > > > > >
> > > > > > On 11/9/05, Oancea Daniel < doancea_at_gmail.com> wrote:
> > > > > > >
> > > > > > > Hi everybody,
> > > > > > >
> > > > > > > I try to develop a jax-rpc client using dynamic proxy client
> > > > > > > and I got the fallowing error:
> > > > > > >
> > > > > > > Exception in thread "main" port: {http://www.test.com/MonitorSvc.wsdl}MonitorSvcPort
> > > > > > > <http://www.test.com/MonitorSvc.wsdl%7DMonitorSvcPort> does
> > > > > > > not contain operation: raiseAlarm
> > > > > > > at com.sun.xml.rpc.client.dii.ConfiguredCall.configureCall(
> > > > > > > ConfiguredCall.java:98)
> > > > > > >
> > > > > > > .........................................................................................................................
> > > > > > >
> > > > > > > here is a snippet from my WSDL description:
> > > > > > > ................................................
> > > > > > > <wsdl:portType name="MonitorSvc">
> > > > > > > <wsdl:operation name="raiseAlarm">
> > > > > > > <wsdl:input message="tns:raiseAlarmRequest"/>
> > > > > > > <wsdl:output message="tns:raiseAlarmResponse"/>
> > > > > > > </wsdl:operation>
> > > > > > > </wsdl:portType>
> > > > > > > <wsdl:binding name="MonitorSvcBinding" type="tns:MonitorSvc">
> > > > > > > <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/
> > > > > > > <http://schemas.xmlsoap.org/soap/http%22/>>
> > > > > > > <wsdl:operation name="raiseAlarm">
> > > > > > > <soap:operation soapAction="raiseAlarm" style="document"/>
> > > > > > > <wsdl:input>
> > > > > > > <soap:body parts="raiseRequest" use="literal"/>
> > > > > > > </wsdl:input>
> > > > > > > <wsdl:output>
> > > > > > > <soap:body parts="raiseResponse" use="literal"/>
> > > > > > > </wsdl:output>
> > > > > > > </wsdl:operation>
> > > > > > > </wsdl:binding>
> > > > > > > <wsdl:service name="MonitorSvcService">
> > > > > > > <wsdl:port binding="tns:MonitorSvcBinding"
> > > > > > > name="MonitorSvcPort">
> > > > > > > <soap:address location="
> > > > > > > http://localhost:8081/MonitorSvc/Alarm"/<http://localhost:8081/MonitorSvc/Alarm%22/>
> > > > > > > >
> > > > > > > </wsdl:port>
> > > > > > > </wsdl:service>
> > > > > > >
> > > > > > > what I'm doing wrong here? (why doesn't recognize raiseAlarm
> > > > > > > operation?)
> > > > > > >
> > > > > > > Any suggestion is overcome! thanks
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>