Complex Return types from web service

Iam developing a web service using axis.In that i want to return array of objects to the client.
But when iam calling from the client side iam getting the class cast exception.
I wrote server-config.wsdd file manually. do i need to add any more if i want to return array of java beans.
<service name="MyService" provider="java:RPC">
      <handler type="soapmonitor"/>
      <handler type="soapmonitor"/>
       <parameter name="allowedMethods" value="*"/>
       <parameter name="className" value="com.a.b.c.X.Y.ServiceDelegate"/>
<beanMapping qname="myNS:ABCVo"
public ABCVo[] getCount(String accessType,long orgId,Date fromDate,Date toDate)
          return ABCVo[];          
I place all the stubs in the client app as a jar file. and the code is just like
ABCVo[] so     =     del.getCount("group",l,calendar,calendar);
Iam getting the following exception:
faultCode: {}Server.userException
faultString: java.lang.ClassCastException: [Ljava.lang.Object;
java.lang.ClassCastException: [Ljava.lang.Object;
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.
at org.apache.axis.encoding.DeserializationContext.endElement(Deserializ
at weblogic.xml.jaxp.WebLogicXMLReader.parse(
at weblogic.xml.jaxp.RegistryXMLReader.parse(
at javax.xml.parsers.SAXParser.parse(
at org.apache.axis.encoding.DeserializationContext.parse(Deserialization
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(
at org.apache.axis.Message.getSOAPEnvelope(
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnders
at org.apache.axis.client.AxisClient.invoke(
at org.apache.axis.client.Call.invokeEngine(
at org.apache.axis.client.Call.invoke(
at org.apache.axis.client.Call.invoke(
at org.apache.axis.client.Call.invoke(
at org.apache.axis.client.Call.invoke(
at com.cscinfo.webservice.client.LmsServiceSoapBindingStub.getSOPCountBy
NatureOfCase(Unknown Source)
at com.cscinfo.cscglobal.web.action.EnterCSCGlobalAction.execute(EnterCS
at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
at org.apache.struts.action.ActionServlet.process(
at org.apache.struts.action.ActionServlet.doGet(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at weblogic.servlet.internal.StubSecurityHelper$
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
at weblogic.servlet.internal.TailFilter.doFilter(
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
at com.cj.trim.trimFilter.doFilter(Unknown Source)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
at weblogicx.servlet.gzip.filter.GZIPFilter.doFilter(
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC

It is working for me. See the following configuration.
<service name="TestService" provider="java:RPC">
          <handler type="soapmonitor"/>
          <handler type="soapmonitor"/>
          <parameter name="allowedMethods" value="*"/>
          <parameter name="className" value=""/>
          <beanMapping qname="ns:XBeanInfo" xmlns:ns="XBeanInfo" languageSpecificType=""/>
     <typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"

Similar Messages

  • Facing problem while going to  catch return result from web-services.

    Hi everybody,
    I am new to BPEL. I am facing problem while going to catch the attributes of resultsets returning from web-services(QAS). As far as my knowledge, two types of results it should return - XML entities and another is attributes which is coming as the part of XML entitites. I am able to catch the XML entities, but can't catch the attributes under it. Even, I am not able to see whether web-services returning something within that field.
    When, I tried to catch the attribute and store to a temporary varilable using the following code:
    *<assign name="AssignQASDoGetAddress1">*
    *<from variable="InvokeQAS_DoSearch_OutputVariable"*
    *<to variable="temp"/>*
    but, I am facing the following selectionFailure errors after running it:
    *"{}selectionFailure" has been thrown.*
    -<selectionFailure xmlns="">
    -<part name="summary">
    empty variable/expression result.
    xpath variable/expression expression "bpws:getVariableData('InvokeQAS_DoSearch_OutputVariable', 'body', '/ns6:QASearchResult/ns6:QAPicklist/ns6:PicklistEntry/@PostcodeRecoded')" is empty at line 269, when attempting reading/copying it.
    Please make sure the variable/expression result "bpws:getVariableData('InvokeQAS_DoSearch_OutputVariable', 'body', '/ns6:QASearchResult/ns6:QAPicklist/ns6:PicklistEntry/@PostcodeRecoded')"is not empty.
    Getting this error it seems to me that web-service is returning nothing, but, it returns something as it has been catched using a method called isPostcodeRecoded() Java Code in Oracle ADF. This method has been used as it should return boolean whereas for catching the xml entities using java code we used the method like getPostcode(), getMoniker().
    For your information, we are using Jdeveloper as the development tool for building the BPEL process.
    Am I doing any syntax error. Please consider it as urgent and provide me asolution.
    Thanks in advance.

    Thanks Dave and Marc, for your suggestions. Actually what I found is QAS web-service is returning nothing as attributes when the attributes are set to the default value. For example, following is the part of the wsdl of the result which QAS webservice returns.
    <xs:element name="QASearchResult">
    - <xs:complexType>
    - <xs:sequence>
    <xs:element name="QAPicklist" type="qas:QAPicklistType" minOccurs="0" />
    <xs:element name="QAAddress" type="qas:QAAddressType" minOccurs="0" />
    <xs:attribute name="VerifyLevel" type="qas:VerifyLevelType" default="None" />
    <xs:complexType name="QAPicklistType">
    - <xs:sequence>
    <xs:element name="FullPicklistMoniker" type="xs:string" />
    <xs:element name="PicklistEntry" type="qas:PicklistEntryType" minOccurs="0" maxOccurs="unbounded" />
    <xs:element name="Prompt" type="xs:string" />
    <xs:element name="Total" type="xs:nonNegativeInteger" />
    <xs:attribute name="AutoFormatSafe" type="xs:boolean" default="false" />
    <xs:attribute name="AutoFormatPastClose" type="xs:boolean" default="false" />
    <xs:attribute name="AutoStepinSafe" type="xs:boolean" default="false" />
    <xs:attribute name="AutoStepinPastClose" type="xs:boolean" default="false" />
    <xs:attribute name="LargePotential" type="xs:boolean" default="false" />
    <xs:attribute name="MaxMatches" type="xs:boolean" default="false" />
    <xs:attribute name="MoreOtherMatches" type="xs:boolean" default="false" />
    <xs:attribute name="OverThreshold" type="xs:boolean" default="false" />
    <xs:attribute name="Timeout" type="xs:boolean" default="false" />
    <xs:complexType name="PicklistEntryType">
    - <xs:sequence>
    <xs:element name="Moniker" type="xs:string" />
    <xs:element name="PartialAddress" type="xs:string" />
    <xs:element name="Picklist" type="xs:string" />
    <xs:element name="Postcode" type="xs:string" />
    <xs:element name="Score" type="xs:nonNegativeInteger" />
    <xs:attribute name="FullAddress" type="xs:boolean" default="false" />
    <xs:attribute name="Multiples" type="xs:boolean" default="false" />
    <xs:attribute name="CanStep" type="xs:boolean" default="false" />
    <xs:attribute name="AliasMatch" type="xs:boolean" default="false" />
    <xs:attribute name="PostcodeRecoded" type="xs:boolean" default="false" />
    <xs:attribute name="CrossBorderMatch" type="xs:boolean" default="false" />
    <xs:attribute name="DummyPOBox" type="xs:boolean" default="false" />
    <xs:attribute name="Name" type="xs:boolean" default="false" />
    <xs:attribute name="Information" type="xs:boolean" default="false" />
    <xs:attribute name="WarnInformation" type="xs:boolean" default="false" />
    <xs:attribute name="IncompleteAddr" type="xs:boolean" default="false" />
    <xs:attribute name="UnresolvableRange" type="xs:boolean" default="false" />
    <xs:attribute name="PhantomPrimaryPoint" type="xs:boolean" default="false" />
    here the attributes like FullAddress, PostcodeRecodedare , etc. are not being return by the web-service when it is getting the default value false. But, if it gets true then , it is being displayed at the BPEL console.
    Do you have any idea how can I catch the attributes and its value even when it gets the default value which is already set. Previously, it was returning(it was not being displayed at the console).
    Thanks once again for your valuable suggestions...!!!

  • How to know return type in Web service

    {color:#0000ff}I am writing a web service client application. After invoking the service it gets the result as SOAP massage. But i need to know the return type also. How can i do that?
    here is the response obtained from web service after invoking a subtract method, it is giving correct value but doesn't give tye of value.
    <ns:SubtractResponse xmlns:ns=""><ns:return>81</ns:return></ns:SubtractResponse>

    View WSDL(Web Service Description Language) file of the web service. Normally WSDL file of any web service can be referenced by appending "wsdl" at the end of web service URL. e.g.
    Shazzad wrote:
    After invoking the service it gets the result as SOAP massage. But i need to know the return type also. How can i do that?WSDL file for a web service contains all information regarding the web service like types, message, portType, binding, service etc. Types section have schema definitions of all messages which are being used in web service. here you can find everything about all elements, fields for all the messages in the WebService including type of the values.
    You can find more about WSDL on Sun and Google very easily.
    Hope this will help.

  • Return values from Web services

    I want to return an array of objects that contain only the allowed Java Types.
    Is it possible to return an array of objects as xml for example from a WL web
    See 5.4.2.
    Cameron Purdy
    Tangosol Inc.
    << Tangosol Server: How Weblogic applications are customized >>
    << Download now from >>
    "George" <[email protected]> wrote in message
    news:3b79243b$[email protected]..
    I want to return an array of objects that contain only the allowed JavaTypes.
    Is it possible to return an array of objects as xml for example from a WLweb

  • Best way to handle Interface Return Type for Web Service Method

    Hi All,
    i have the followinig situation. I would like to create a method as a web service:
    Customer getCustomer(someType){....}
    ie: getCustomer method, with a parameter that indicates some backend data source. The method returns a Customer object. However, depending on the datasource this method uses (which is dependent on the type passed in, ie FooDB, BarDB etc) then i return either a:
    FooCustomer extends AbstractCustomer implements Customer
    BarCustomer extends AbstractCustomer implements Customer
    Now this fails because JAXB cant handle interfaces because when sending XML over the wire it needs a concrete representation (as far as i understand).
    So how should i deal with this?
    Do I need to create a differnet method for each datasource (foo DB, bar DB), ie:
    FooCustomer getFooCustomer()
    BarCustomer getBarCustomer()
    or do i continue calling getCustomer but somehow indicate in the WSDL that I have an AbstractCustomer object and some other bits from FooCusotmer or BarCustomer or ....
    kinda stumpeed here? I wouldve thought itd be handy to be able to do this (ie: call one getCustomer() method and get back Customer objects representing nay type of customer ... in some way...but cant see how to achieve this.
    Any pointers would be greatly appreciated

    Try to explore abstract schema type.

  • Working with complex data types in web services ...

    Hi All,
    I have created a webservice and created an interface for that in ADF. Now as my web service returns a complex data type, i followed the steps given in this article "" and it works fine, my results also get displayed. But only issue is i get a warning "JBO-25009: Cannot create an object of type:java.util.calendar with value:2008-09-23T23:51:30.000+05:30" and if i replace all the java.util.Date with oracle.jbo.domain.Date then i get a warning "JBO-25009: Cannot create an object of type:oracle.jbo.domain.Date with value:2008-09-23T23:51:30.000+05:30". Now i am unable to understand this although i believe it is a data type mapping issue, but not sure how to rectify it.
    Anybody knows the wayout?

    Thanks for youe response. I also tried makeing data type as string in place of date in data control.xml and it worked fine. So it confirms that i am facing with exactly similar issue as yours.
    I tried solution 2 mentioned in Frank's mail but its not helping[in fact i am already using web proxy as i am delaing with complex data types]. I created a web proxy and in java bean i placed break points to check the control flow[in order to check the root cause] but control never reaches the java bean!! I am not sure about the cause for it...control should pass through java bean isn't it??
    I am quite new to can somebody just elaborate on how to rectify this using web proxy. I have been using this rl "" to work with web proxies" to work with proxies.

  • Custom/Complex data types in web services

    I've read in several articles here on otn that JDev 9.0.3 would have better support for
    creating web services with complex datatypes (like java.util.LinkedList), but still (in the 9.0.3 Preview)
    theese methods are greyed out on the web service wizard. Am I missing something?
    Until now I've worked with Custom Serializers, but they are time consuming and hard to work with.

    Here are the two articles that will help:
    JavaBeans as Web services parameter types:
    Registering Web services custom serializers:
    The new support in JDev 9.0.3 is that JavaBean parameters are now recognized by the JDev publishing wizards whereas in JDev 9.0.2 there was the workaround pointed to by the first article. In 9.0.2 the publishing support was only for primitive data types.
    The upside of the custom serializers, is you can re-use your existing serializers if they happen to have been written to Apache SOAP.

  • Re: Returning Objects from Web Services

    I'm doing a project which uses Java web services. I'm using the Web Services templates under Netbeans 6 IDE to accomplish this.
    I have followed some basic tutorials and have set up a service that returns integer datatypes etc. I need to know how I can return an object from a webservice and have a client retrieve the attributes of this object.
    I have attempted this, and it returns [email protected], the name of my class is "Comp", the package is "server" and I guess the hex value is the address of the object pointer.
    I've been looking around all day and I can't seem to figure this out. Could someone explain to me how this is done. Or maybe even point me in the right direction?

    From what you have written I assume you don't understand how to read/set object properties thats why it doesn't work for you. You can follow many tutorials found on the web like this one:
    When using Netbeans 6.0 or 5.5 basicaly you don't have to do much to create ws and ws consumer, just follow the wizards.
    1. Create the web service (either as a web applicaton or EJB)
    2. Create Java SE application, set "create main method" option
    3. Right click on the SE project and choose Create Web Service client,
    4. Pick up the WSDL of earlier developed web service
    5. Click Finish to generate the stubs.
    6. Expand created folder with generated stubs up to the method names
    7. Drag the method in the SE project main method scope
    For sure you can find more detailed tutorials on the web. Good luck!

  • How to access  complex data type from a soap web services?

    can u please tell me how can i access complex data type from a soap web service from jdeveloper 10g
    Jdeveloper generates 3 classes
    i have to retreview the data which is a complex data type it gives some
    unknown type. and the return value is a key-value pair data type .

    After you create the partner link and the invoke (to create the variables), change the element type of the response message to the complex type definition of your collection that appears in the XSD. You can do the same thing if you want to change the element type of the payload of the request message as well.

  • Complex return type for operations in Application Services

    Hi all,
    I am trying to create a complex return type for one of operation in CAF Application service.I have created a complex dataStructure  named productList and added product bussiness object as its attribute with cardinality 0--n. And used product dataType as my return type.
    But I am not getting any output but its work fine with cardinality 0--1.
    I am using CE 7.1 SP5 trial version.......
    Can anyone

    And used product dataType as my return type.
    Are you sure you did not forgot to change you operations return type to "productList"?
    Best regards

  • CE7.1 SP3/SP4 Application service - complex return type

    Hi all,
    can anybody tell me how to create an operation with a complex return type (collection) within an application service.I can't find it in the documentation!
    I would appreciate helpful answers.

    It isnt that tough ... following are the steps ..
    Suppose you want to return a list of customers. First create a structure "Customer". Once that is done create another structure "CustomerList" ... now add "Customer" to it as the attribute. Set the cardinality of this "Customer" attribute as 0-n or 1-n ...
    Thats it .. Hope this helps.

  • Can objects returned from web services be cast to strongly typed objects?

    Can objects returned from web services be cast to strongly
    typed objects?
    Last I tried this was with one of the beta of Flex2 and it
    did not work. You had to use ObjectProxy or something like that...

    Please post this question in the CRM On Demand Integration Development forum.

  • How to show all data returned from web service in a dashboard

    Hi I need  create a dashboard with conection with a web service  and  whitout  establish a range in excel,  so be displayed on the dashboard n rows returned by the web service.
    how can I do this?

    Hi Ezequiel,
    I agree with Alan.
    You might find it useful to read the Xcelsius 2008 Best Practices whitepaper: []

  • Dates coming from web service

    I'm currently trying to consume in VC a CAF Application Service exposed as a Web Service. I'm able to retrieve what I want but I have a problem with dates format.
    The web service returns dates in the following format: YYYY-MM-DDTHH:NN:SS
    When I test my data service in VC it works fine. When I run my iview, VC swap the month and the day and compute the new date...
    It's not just a problem of formatting with DVAL and DSTR because the date is already computed.
    Date returned from web service: 2007-09-21T00:00:01
    Date returned from test data service in VC: 21.09.2007
    Date returned at runtime: 09.09.2008
    VC understand 21.09.2007 not like DD.MM.YYYY but like MM.DD.YYYY so 21.09.2007 becomes 09.09.2008
    I also tried to check on the server Regional and Language option but it doesn't come from there.
    Have you ever faced this problem?

    It is a Web Service generated by NWDS (to expose my CAF Application Service)and deployed on the server.
    The url si like http://<hostname>:<port>/mywebservice/Config1?wsdl
    The Web Service runs correctly.
    When I call a method of my web service to retrieve a list of objects (CAF Entity Services) and their attributes, it returns attributes of type String and Dates of type 'java.util.GregorianCalendar'.
    It seems that VC doesn't correctly understand this type of Date at runtime

  • Presence data from web service

    i like to get presence data from the presenceconsumer web service. But everytime a call getUserPresence i get a PolicyException (POL0002): 'Privacy verification failed for address %1, request is refused'.
    I use a web service proxy generated from the wsdl of the presenceconsumer web service. Authentication is made against the appregationproxy by setting username and password. Both users (the one i use for authentication and the one whose presence data i want to get) are registered in the timesten database.
    The user whose presence data should be accessed is logged in the OracleCommunicator and has the other user on the allowed list for presence data.
    All other operations of the presence web services work without any problem, so why not getUserPresence?
    Thanks for help

    I have found the problem and fixed it :)
    If you see my code, I was checking for the pending subscriptions after publish() method. When I tried this check before publish() method, I got the expected results (All the pending subscriptions).
    Also, I got an error (ServiceException) while dynamically retrieving the subscribed attributes for some reason. I have found an alternative solution, by manually allowing only the PresenceAttributeType.Activity (instead of all getSubscribedAttributes()).
    Note: This code was working fine in my local machine because, I have already setup-ed the users (Buddy list) through Oracle communicator in my machine. I was not able to install OC in the VM for some reason though OS is same in both my machine and the VM (OS: Windows 2000 SP4).
    thanks & regards,
    S.Vasanth Kumar.
    My latest code for your reference.
    package presencedemo;
    import java.rmi.RemoteException;
    import java.util.Calendar;
    import org.csapi.schema.parlayx.common.v2_0.PolicyException;
    import org.csapi.schema.parlayx.common.v2_0.ServiceException;
    import org.csapi.schema.parlayx.common.v2_0.SimpleReference;
    import org.csapi.schema.parlayx.presence.v2_0.ActivityValue;
    import org.csapi.schema.parlayx.presence.v2_0.AttributeTypeAndValue;
    import org.csapi.schema.parlayx.presence.v2_0.CommunicationMeans;
    import org.csapi.schema.parlayx.presence.v2_0.CommunicationMeansType;
    import org.csapi.schema.parlayx.presence.v2_0.CommunicationValue;
    import org.csapi.schema.parlayx.presence.v2_0.OtherValue;
    import org.csapi.schema.parlayx.presence.v2_0.PlaceValue;
    import org.csapi.schema.parlayx.presence.v2_0.PresenceAttribute;
    import org.csapi.schema.parlayx.presence.v2_0.PresenceAttributeType;
    import org.csapi.schema.parlayx.presence.v2_0.PresencePermission;
    import org.csapi.schema.parlayx.presence.v2_0.PrivacyValue;
    import org.csapi.schema.parlayx.presence.v2_0.SphereValue;
    import org.csapi.schema.parlayx.presence.v2_0.SubscriptionRequest;
    import org.csapi.wsdl.parlayx.presence.consumer.v2_0.interface_.PresenceConsumerClient;
    import org.csapi.wsdl.parlayx.presence.supplier.v2_0.interface_.PresenceSupplierClient;
    * This class contains the primary functionality for
    * connecting to the Presence Server and retreiving
    * presence information for a set of buddies
    public class PresenceDemoClient {
    PresenceSupplierClient supplier;
    PresenceConsumerClient consumer;
    private String PresenceServer;
    private String PresenceUsername;
    private String PresencePassword;
    private String PresenceRealm;
    private String PresencePort;
    URI BuddyList[];
    PresenceAttributeType[] pat1;
    // Constructor - creates a supplier and consumer presence client
    // for publishing, subscribing to, and retrieving user presence.
    public PresenceDemoClient(String server, String username, String password,
    String realm, String port, URI[] buddies) {
    try {
    supplier = new PresenceSupplierClient();
    consumer = new PresenceConsumerClient();
    PresenceServer = server;
    PresenceUsername = username;
    PresencePassword = password;
    PresenceRealm = realm;
    PresencePort = port;
    BuddyList = new URI[buddies.length];
    BuddyList = (URI[])buddies.clone();
    } catch (Exception e) {
    // publishPresence - this method publishes presence on behalf of the
    // current user. Allowed information includes and activityString and a note
    public void publishPresence(String activityString, String note) {
    try {
    System.out.println("Publishing presence for " + PresenceUsername);
    // create supplier web service endpoint
    supplier.setEndpoint("http://" + PresenceServer + ":" +
    PresencePort +
    System.out.println("Supplier URL: " + "http://" + PresenceServer + ":" +
    PresencePort +
    ActivityValue activity = null;
    String expires = "3600"; // default expiration of subscription
    if (note == null || note.length() < 1)
    note = "From Web Service Client";
    if (activityString == null)
    activity = ActivityValue.ActivityNone;
    else if (activityString.equals("Available"))
    activity = ActivityValue.Available;
    else if (activityString.equals("Busy"))
    activity = ActivityValue.Busy;
    else if (activityString.equals("Meeting"))
    activity = ActivityValue.Meeting;
    else if (activityString.equals("Away"))
    activity = ActivityValue.Away;
    activity = ActivityValue.ActivityNone;
    PresenceAttribute pa = new PresenceAttribute();
    AttributeTypeAndValue typeValue = new AttributeTypeAndValue();
    if (Integer.parseInt(expires) == 0)
    CommunicationMeans mean = new CommunicationMeans();
    System.out.println(new URI("sip:" + PresenceUsername + "@" +
    mean.setContact(new URI("sip:" + PresenceUsername + "@" +
    CommunicationValue commValue = new CommunicationValue();
    commValue.setMeans(new CommunicationMeans[] { mean });
    OtherValue other = new OtherValue();
    //Allowing all pending subscriptions
    SubscriptionRequest[] srArray = supplier.getOpenSubscriptions();
    for (SubscriptionRequest sr:srArray) {
    URI watcher = sr.getWatcher().normalize();
    /*System.out.println("Blocking: " + watcher);
    System.out.println("Allowing: " + watcher);
    /*PresenceAttributeType patArray[] = supplier.getSubscribedAttributes(watcher.toString());
    PresencePermission permissions[] = new PresencePermission[supplier.getSubscribedAttributes(watcher.toString()).length];
    for(int i=0;i<patArray.length;i++){
    PresenceAttributeType pat = patArray;
    System.out.println("\tPermission: " + pat);
    PresencePermission pp = new PresencePermission();
    pp.setPresenceAttribute(pat); //You always pass in Activity
    pp.setDecision(true); //Put the user on the allow list
    permissions[i] = pp;
    PresenceAttributeType pat = PresenceAttributeType.Activity;
    PresencePermission pp = new PresencePermission();
    pp.setPresenceAttribute(pat); //You always pass in Activity
    pp.setDecision(true); //Put the user on the allow list
    supplier.updateSubscriptionAuthorization(watcher,new PresencePermission[]{pp});
    Calendar dateTime = Calendar.getInstance();
    supplier.publish(new PresenceAttribute[] { pa });
    System.out.println("Publish done: " + "sip:" + PresenceUsername + "@" +
    } catch (Exception e) {
    System.out.println("Publish failed: " + e.toString());
    // subscribePresence - this method subscribes to
    // presence information of buddylist members
    public void subscribePresence() {
    try {
    // create web services endpoint
    consumer.setEndpoint("http://" + PresenceServer + ":" +
    PresencePort +
    System.out.println("Consumer URL: " + "http://" + PresenceServer + ":" +
    PresencePort +
    // Setting the attribute to activity.
    PresenceAttributeType pa = PresenceAttributeType.Activity;
    PresenceAttributeType[] pat = new PresenceAttributeType[] { pa };
    // These input are required but not used.
    SimpleReference sr = new SimpleReference();
    sr.setEndpoint(new URI(""));
    int counter = 0;
    // Calling the subscribe web service with sip
    // address of each buddy
    for (counter = 0; counter < BuddyList.length; counter++) {
    System.out.println("Subscribing presence for: " + BuddyList[counter]);
    consumer.subscribePresence(BuddyList[counter], pat, "unused",
    Thread.sleep(3000); // Give the backend enough time to get the subscription.
    // Define Presence Activity types and attribute storage
    PresenceAttributeType pa1 = PresenceAttributeType.Activity;
    pat1 = new PresenceAttributeType[] { pa1 };
    } catch (Exception e) {
    System.out.println("Exception " + e.toString());
    // getUserPresence - this method retuns the presence information
    // of a particular buddy(user)
    public PresenceAttribute getUserPresence(URI user) {
    PresenceAttribute pa;
    try {
    System.out.println(consumer.getEndpoint() + "," + consumer.getUsername());
    pa = consumer.getUserPresence(user, pat1)[0];
    } catch (PolicyException pEx) {
    pa = null;
    System.out.println("PolicyException:getUserPresence: " + pEx.getMessageId() + ":" + pEx.getText());
    String[] variables = pEx.getVariables();
    for(String str:variables){
    } catch (ServiceException serEx) {
    pa = null;
    System.out.println("ServiceException:getUserPresence: " + serEx.toString());
    } catch (RemoteException rEx) {
    pa = null;
    System.out.println("RemoteException:getUserPresence: " + rEx.toString());
    return pa;
    public static void main(String args[]) throws Exception{
    URI[] buddy_list = {new URI("sip:[email protected]"),new URI("sip:[email protected]"),new URI("sip:[email protected]")};
    PresenceDemoClient client = new PresenceDemoClient("","employee1","welcome1","vitkovice","8888",buddy_list);
    URI[] buddy_list2 = {new URI("sip:[email protected]"),new URI("sip:[email protected]"),new URI("sip:[email protected]")};
    PresenceDemoClient client2 = new PresenceDemoClient("","employee2","welcome1","vitkovice","8888",buddy_list2);
    URI[] buddy_list3 = {new URI("sip:[email protected]"),new URI("sip:[email protected]"),new URI("sip:[email protected]")};
    PresenceDemoClient client3 = new PresenceDemoClient("","employee3","welcome1","vitkovice","8888",buddy_list3);
    URI[] buddy_list4 = {new URI("sip:[email protected]"),new URI("sip:[email protected]"),new URI("sip:[email protected]")};
    PresenceDemoClient client4 = new PresenceDemoClient("","employee4","welcome1","vitkovice","8888",buddy_list4);
    Thread.sleep(10000); //Allow some time for all the subscription notifications.
    PresenceAttribute pa = client.getUserPresence(buddy_list[0]);
    System.out.println(buddy_list[0] + ": " + pa.getTypeAndValue().getActivity() + " " + pa.getNote());
    PresenceAttribute pa2 = client2.getUserPresence(buddy_list2[0]);
    System.out.println(buddy_list2[0] + ": " + pa2.getTypeAndValue().getActivity() + " " + pa2.getNote());
    PresenceAttribute pa3 = client2.getUserPresence(buddy_list3[0]);
    System.out.println(buddy_list3[0] + ": " + pa3.getTypeAndValue().getActivity() + " " + pa3.getNote());
    PresenceAttribute pa4 = client2.getUserPresence(buddy_list4[0]);
    System.out.println(buddy_list4[0] + ": " + pa4.getTypeAndValue().getActivity() + " " + pa4.getNote());

Maybe you are looking for

  • Date format in ALV report

    Hi all, I want to change date format in ALV list that is displayed in wrong format. I use this piece of code: CALL METHOD r_alv_grid->set_table_for_first_display     EXPORTING       i_structure_name = 'ZSTANJEKOMISIONARA'       is_layout        = gs_

  • Using a hashmap for caching -- performance problems

    Hello! 1) DESCRIPTION OF MY PROBLEM: I was planing to speed up computations in my algorithm by using a caching-mechanism based on a Java HashMap. But it does not work. In fact the performance decreased instead. My task is to compute conditional proba

  • Boot-up Disk Choice in in Yosemite Style (black background) instead of white

    I have a MacBook Pro Retina 15" Late 2013 currently running OS X Mavericks. Yesterday I installed OS X Yosemite on a partition of my external HDD to try it out, and everything went smoothly. After a while I rebooted Mavericks and deleted the partitio

  • How can i get the exact Range of  codePoints of every UnicodeScript(Block)?

    hello dear all, this problem has puzzled me for a long time. how can i get the exact Range of codePoints of every UnicodeScript(Latin,Han,.....) or UnicodeBlock(Basic_Latin, Latin-1 Supplement, Linear B,......)? so that i can do some iterations to di

  • BI JAVA  incorrect URL while accessing portal from RSPLAN

    Hi   We have implemented BI JAVA by connecting our existing BI ABAP system SP15 to the newly created JAVA server. We installed Netweaver2004s  SR3 SP14 JAVA portal on a seperate server and configured BI JAVA on it.   Now When a user goes to transacti