You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-user@ws.apache.org by Johannes Echterhoff <ec...@uni-muenster.de> on 2008/05/06 13:50:02 UTC
generating sources for service using quite complex schema
Hello.
I would like to use muse for my scenario but run into problems just when
I wanted to do more than the tutorial. Before describing the problem, I
would like to outline my scenario shortly so that you get an
understanding of what I want to achieve. Did I already mention that I am
a newbie to muse. :-)
I have to warn you: this email is quite large - so better get a new cup
of coffee before reading.
The scenario is as follows: Sensors generate observations which are
pushed to the service (so the service may act like a notification
broker). The observations are published on one topic while sensor status
messages (created by the service) are published on another. Clients can
subscribe for both types of messages. For the observation topic
subscribers can use message content filters that allow at least xpath
expressions but can also be more specific filters (encoded in XML).
I would like to extend the notification producer interface with some
additional operations (DescribeSensor, GetCapabilities). Depending on
the use case, even the RegisterPublisher and Notify operation from WSN
could be realized by that service. If so, the RegisterPublisher request
would make use of the extensibility mechanism defined for that operation
to send also the sensor description in XML.
Feedback on how muse could / should be used to handle this scenario
would be most appreciated!
Ok, let me explain what I accomplished so far. First of all, I tried to
create a wsdl description for the new service. As I am not too familiar
with using wsdl defined web services, I may have made silly mistakes -
if so please tell me what I did wrong. That wsdl used imports to
reference definitions from other wsdl files (the WS-Notification and
-Resource specs). For my custom operations I needed to import schema
which defined the request / response messages and types used in these
operations.
After some trials with wsdlmerge I got this exception message:
C:\muse-test\wsdlmerge_test>wsdlmerge.bat -uri http://www.opengis.net/sas/1.0.0
-address http://localhost:8080/52nSAS/sas -output SASmerged.wsdl -verbose SAS.ws
dl WS-BaseNotification-1_3.wsdl WS-BrokeredNotification-1_3.wsdl WS-Resource-1_2
.wsdl WS-ResourceProperties-1_2.wsdl
SEVERE: [ID = 'WsdlMergeFailed'] wsdlmerge encountered an error. Use -verbose to
see more detailed information.
An exception was caught: null
The exception generated the following stacktrace:
java.lang.NullPointerException
at org.apache.muse.tools.generator.util.DefinitionInfo.createOutput(Defi
nitionInfo.java:198)
at org.apache.muse.tools.generator.util.DefinitionInfo.createOperation(D
efinitionInfo.java:173)
at org.apache.muse.tools.generator.util.DefinitionInfo.addOperation(Defi
nitionInfo.java:308)
at org.apache.muse.tools.generator.WsdlMerge.copyOperations(WsdlMerge.ja
va:340)
at org.apache.muse.tools.generator.WsdlMerge.merge(WsdlMerge.java:219)
at org.apache.muse.tools.generator.WsdlMerge.run(WsdlMerge.java:141)
at org.apache.muse.tools.generator.WsdlMerge.main(WsdlMerge.java:113)
The wsdl is attached (SAS.wsdl).
I also created my own wsdl (see attached wsdl: SASallinone.wsdl) which
contains all the message definitions and which imports all required
schema (quite a bunch). Then I run wsdl2java. That worked, but the
result is not exactly what I expected (though that may be due to my
insufficient knowledge of muse). Also, there was a warning that I do not
understand because the WS-ResourceProperties-1_2.xsd is in the directory
where the wsdl file is and the schema import looks ok to me:
C:\muse-test\wsdl>wsdl2java.bat -j2ee mini -wsdl SASallinone.wsdl -output test -verbose
WARNING: [ID = 'NoWSRPSchema'] No WS-RP schema found.
C:\muse-test\wsdl>wsdlmerge
However, code has been generated; the classes (excluding the interfaces)
look like this:
(MyCapability1)
package org.oasis_open.docs.wsn.br_2;
import org.apache.muse.ws.addressing.EndpointReference;
import org.apache.muse.core.AbstractCapability;
import java.util.Date;
import org.w3c.dom.Element;
public class MyCapability extends AbstractCapability implements IMyCapability {
public Element registerPublisher(EndpointReference PublisherReference, Element[] Topic, boolean Demand, Date InitialTerminationTime) throws Exception {
//TODO implement registerPublisher
throw new RuntimeException("Unimplemented Method: registerPublisher");
}
}
(MyCapability2)
package net.opengis.www.sas._1.0.0;
import org.apache.muse.core.AbstractCapability;
import org.w3c.dom.Element;
public class MyCapability extends AbstractCapability implements IMyCapability {
public Element getCapabilities() throws Exception {
//TODO implement getCapabilities
throw new RuntimeException("Unimplemented Method: getCapabilities");
}
public Element describeSensor(Element SensorID) throws Exception {
//TODO implement describeSensor
throw new RuntimeException("Unimplemented Method: describeSensor");
}
}
There are several questions that I have:
* concerning the generated sources:
o The getCapabilities method (in MyCapability2) should expect
some XML input - do you have any idea why the generated
method only has a return parameter? Is that due to the fact
that I used doc/literal?
o The describeSensor method (in MyCapability2) looks ok - if
the SensorID Element is actually the complete DescribeSensor
request XML document which would be send by a client in the
SOAP body. Looking at the registerPublisher method, it seems
like wsdl2java removes the top-level XML fragment from the
request (in this case the RegisterPublisher XML element) and
lists all elements contained in that element instead (even
converting them if they are of simple type).
o Neither of the capability classes extends
AbstractWsResourceCapability - is that due to the fact that
I did not extend the resource type with my own elements
(i.e., it just lists elements from WSN, WSRF and MUWS)?
o The registerPublisher method (in MyCapability1) takes the
elements contained in a usual RegisterPublisher request,
i.e. as they are listed in the schema from OASIS, as
parameters. As I said earlier I would like to make use of
the extension mechanism for that operation. Do I therefore
have to modify the schema before generating source code or
is there some way to retrieve the pure request body via muse?
o In the SASallinone.wsdl I added the Notify operation from
the NotificationConsumer interface to the services binding
and port type.
* in general:
o According to the SubscriptionManager.wsdl that is contained
in the generated folders (WebContent/WEB-INF/classes/wsdl)
there will be one subscription manager that will be
referenced in all Subscribe request responses. So will each
subscription reference the same manager? Will a Renew or
Destroy request for a certain Subscription be differentiated
from requests to other Subscriptions via some parameters
added by muse to the subscription endpoint?
o How could we implement a RegisterPublisherManager in muse?
Would we just have to add another service binding to the
wsdl before generating source code? The operations of that
manager would be quite similar to those of the
SubscriptionManager, could we profit from that?
Please help me getting started.
Thanks.
Johannes
Re: generating sources for service using quite complex schema
Posted by Johannes Echterhoff <ec...@uni-muenster.de>.
Hi.
So far there was no answer to my questions. So I am wondering whether my
first email contained just too much questions for a single email. Should
I split the problems I encountered into several emails so that they can
be handled with more focus on each specific problem?
Best regards,
Johannes
Johannes Echterhoff schrieb:
> Hello.
>
> I would like to use muse for my scenario but run into problems just
> when I wanted to do more than the tutorial. Before describing the
> problem, I would like to outline my scenario shortly so that you get
> an understanding of what I want to achieve. Did I already mention that
> I am a newbie to muse. :-)
>
> I have to warn you: this email is quite large - so better get a new
> cup of coffee before reading.
>
> The scenario is as follows: Sensors generate observations which are
> pushed to the service (so the service may act like a notification
> broker). The observations are published on one topic while sensor
> status messages (created by the service) are published on another.
> Clients can subscribe for both types of messages. For the observation
> topic subscribers can use message content filters that allow at least
> xpath expressions but can also be more specific filters (encoded in XML).
>
> I would like to extend the notification producer interface with some
> additional operations (DescribeSensor, GetCapabilities). Depending on
> the use case, even the RegisterPublisher and Notify operation from WSN
> could be realized by that service. If so, the RegisterPublisher
> request would make use of the extensibility mechanism defined for that
> operation to send also the sensor description in XML.
>
> Feedback on how muse could / should be used to handle this scenario
> would be most appreciated!
>
>
> Ok, let me explain what I accomplished so far. First of all, I tried
> to create a wsdl description for the new service. As I am not too
> familiar with using wsdl defined web services, I may have made silly
> mistakes - if so please tell me what I did wrong. That wsdl used
> imports to reference definitions from other wsdl files (the
> WS-Notification and -Resource specs). For my custom operations I
> needed to import schema which defined the request / response messages
> and types used in these operations.
>
> After some trials with wsdlmerge I got this exception message:
>
> C:\muse-test\wsdlmerge_test>wsdlmerge.bat -uri
> http://www.opengis.net/sas/1.0.0
> -address http://localhost:8080/52nSAS/sas -output SASmerged.wsdl
> -verbose SAS.ws
> dl WS-BaseNotification-1_3.wsdl WS-BrokeredNotification-1_3.wsdl
> WS-Resource-1_2
> .wsdl WS-ResourceProperties-1_2.wsdl
>
> SEVERE: [ID = 'WsdlMergeFailed'] wsdlmerge encountered an error. Use
> -verbose to
> see more detailed information.
>
> An exception was caught: null
>
> The exception generated the following stacktrace:
>
> java.lang.NullPointerException
> at
> org.apache.muse.tools.generator.util.DefinitionInfo.createOutput(Defi
> nitionInfo.java:198)
> at
> org.apache.muse.tools.generator.util.DefinitionInfo.createOperation(D
> efinitionInfo.java:173)
> at
> org.apache.muse.tools.generator.util.DefinitionInfo.addOperation(Defi
> nitionInfo.java:308)
> at
> org.apache.muse.tools.generator.WsdlMerge.copyOperations(WsdlMerge.ja
> va:340)
> at
> org.apache.muse.tools.generator.WsdlMerge.merge(WsdlMerge.java:219)
> at
> org.apache.muse.tools.generator.WsdlMerge.run(WsdlMerge.java:141)
> at
> org.apache.muse.tools.generator.WsdlMerge.main(WsdlMerge.java:113)
>
> The wsdl is attached (SAS.wsdl).
>
>
> I also created my own wsdl (see attached wsdl: SASallinone.wsdl) which
> contains all the message definitions and which imports all required
> schema (quite a bunch). Then I run wsdl2java. That worked, but the
> result is not exactly what I expected (though that may be due to my
> insufficient knowledge of muse). Also, there was a warning that I do
> not understand because the WS-ResourceProperties-1_2.xsd is in the
> directory where the wsdl file is and the schema import looks ok to me:
>
> C:\muse-test\wsdl>wsdl2java.bat -j2ee mini -wsdl SASallinone.wsdl
> -output test -verbose
>
> WARNING: [ID = 'NoWSRPSchema'] No WS-RP schema found.
>
> C:\muse-test\wsdl>wsdlmerge
>
>
> However, code has been generated; the classes (excluding the
> interfaces) look like this:
>
> (MyCapability1)
>
> package org.oasis_open.docs.wsn.br_2;
>
> import org.apache.muse.ws.addressing.EndpointReference;
> import org.apache.muse.core.AbstractCapability;
> import java.util.Date;
> import org.w3c.dom.Element;
>
> public class MyCapability extends AbstractCapability implements
> IMyCapability {
> public Element registerPublisher(EndpointReference
> PublisherReference, Element[] Topic, boolean Demand, Date
> InitialTerminationTime) throws Exception {
> //TODO implement registerPublisher
> throw new RuntimeException("Unimplemented Method:
> registerPublisher");
> }
> }
>
>
> (MyCapability2)
>
> package net.opengis.www.sas._1.0.0;
>
> import org.apache.muse.core.AbstractCapability;
> import org.w3c.dom.Element;
>
> public class MyCapability extends AbstractCapability implements
> IMyCapability {
> public Element getCapabilities() throws Exception {
> //TODO implement getCapabilities
> throw new RuntimeException("Unimplemented Method:
> getCapabilities");
> }
> public Element describeSensor(Element SensorID) throws Exception {
> //TODO implement describeSensor
> throw new RuntimeException("Unimplemented Method:
> describeSensor");
> }
> }
>
>
> There are several questions that I have:
>
> * concerning the generated sources:
> o The getCapabilities method (in MyCapability2) should expect
> some XML input - do you have any idea why the generated
> method only has a return parameter? Is that due to the fact
> that I used doc/literal?
> o The describeSensor method (in MyCapability2) looks ok - if
> the SensorID Element is actually the complete DescribeSensor
> request XML document which would be send by a client in the
> SOAP body. Looking at the registerPublisher method, it seems
> like wsdl2java removes the top-level XML fragment from the
> request (in this case the RegisterPublisher XML element) and
> lists all elements contained in that element instead (even
> converting them if they are of simple type).
> o Neither of the capability classes extends
> AbstractWsResourceCapability - is that due to the fact that
> I did not extend the resource type with my own elements
> (i.e., it just lists elements from WSN, WSRF and MUWS)?
> o The registerPublisher method (in MyCapability1) takes the
> elements contained in a usual RegisterPublisher request,
> i.e. as they are listed in the schema from OASIS, as
> parameters. As I said earlier I would like to make use of
> the extension mechanism for that operation. Do I therefore
> have to modify the schema before generating source code or
> is there some way to retrieve the pure request body via muse?
> o In the SASallinone.wsdl I added the Notify operation from
> the NotificationConsumer interface to the services binding
> and port type.
> * in general:
> o According to the SubscriptionManager.wsdl that is contained
> in the generated folders (WebContent/WEB-INF/classes/wsdl)
> there will be one subscription manager that will be
> referenced in all Subscribe request responses. So will each
> subscription reference the same manager? Will a Renew or
> Destroy request for a certain Subscription be differentiated
> from requests to other Subscriptions via some parameters
> added by muse to the subscription endpoint?
> o How could we implement a RegisterPublisherManager in muse?
> Would we just have to add another service binding to the
> wsdl before generating source code? The operations of that
> manager would be quite similar to those of the
> SubscriptionManager, could we profit from that?
>
> Please help me getting started.
>
> Thanks.
>
> Johannes
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: muse-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org