Returning XML to client from web service
Hi,
I am new to developing web services using JAX_RPC. I am trying to return a xml document to the client from the web service.
My Server implementation is as follows:
Interface:
public interface OntoIF extends Remote
public DataHandler ontoCompare (String targetUrl,String sourceUrl ) throws RemoteException;
Implementaion:
public class OntoImpl implements OntoIF
public DataHandler ontoCompare (String targetUrl,String sourceUrl ) throws RemoteException
DataHandler dataHandler = new DataHandler( new StreamSource( new File ("status.xml")), "text/xml");
return dataHandler;
Client Implementation:
Stub stb = (Stub) (new OntoService_Impl().getOntoIFPort());
stb._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,
"http://localhost:8080/onto-service/onto");
OntoIF onto = (OntoIF) stb;
DataHandler retDHandler = onto.ontoCompare(targetOntoUrl, sourceOntoUrl);
When I compile and run my client, it throws the following error -
java.rmi.ServerException: JAXRPCSERVLET28: Missing port information
at com.sun.xml.rpc.client.StreamingSender._raiseFault(StreamingSender.ja
va:497)
at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:294
at sstub.OntoIF_Stub.echoDataHandler(OntoIF_Stub.java:122)
at sstub.OntoClient.main(OntoClient.java:63)
Can you please let me know what I am doing wrong? I have no problems in sending a DataHandler but receiving the DataHandler from the web service throws errors.
Thanks!
Hi I'm having the same problem. I try to set up a Web Service using JAX_RPC. My WS should invoke a native Method implemented in C++. Did you got a solution for this issue? My Error Message is as follows:
java.rmi.ServerException: JAXRPCSERVLET28: Missing port information
at com.sun.xml.rpc.client.StreamingSender._raiseFault(StreamingSender.java:497)
at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:294)
at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:80)
at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:489)
at com.sun.xml.rpc.client.dii.CallInvocationHandler.doCall(CallInvocationHandler.java:122)
at com.sun.xml.rpc.client.dii.CallInvocationHandler.invoke(CallInvocationHandler.java:86)
at $Proxy0.getHello(Unknown Source)
at com.neuhaus.test.ws.client.NativeInvokeClient.main(NativeInvokeClient.java:44)
Exception in thread "main"
greetings, JAN
Similar Messages
-
Error returning large String arrays from web service
Hi,
I currently have an EJB that returns a String[] array that I have implemented as
a Web Service. When I execute a Java client (JSP) from Weblogic, I don't have a problem
as long as the returned array is relatively small, but when the array starts to get
a little larger (say 20 elements, about 30 chars each), I consistently get:
SAXException: java.lang.IllegalArgumentException:array element type mismatch.
Strangely enough, when my web service client is a .asp page running under MS IIS
(using the MS SOAP Toolkit), it works fine. I have returned as many as 15000 - 20000
array elements in one call. And since I am calling the same Weblogic EJB with the
MS client, I know it's a problem with the Java client, not the EJB.
Anybody know of a bug or had this experience before? Or know what I might be doing
wrong? FYI, I am using Weblogic 6.1 SP2.
Thanks,
SteveHi Steve,
Sure we're interested...I'll pass this along to the XML folks.
Thanks for the feedback,
Bruce
Steve Alexander wrote:
In case anyone is interested, I solved my problem. I was mis-diagnosing the problem
- thinking it was a size issue when it actually was a data issue. On the calls where
I was returning a large array, some of the array members were null. When I made them
enpty strings "", it worked. Apparently the default SAX parser BEA uses doesn't like
the nulls, whereas the MS parser doesn't care.
"Steve Alexander" <[email protected]> wrote:
Thanks Bruce,
FYI - I have reproduced the problem on WL7.0. I have turned it in to support
as you
suggested.
Steve
Bruce Stephens <[email protected]> wrote:
Hi Steve,
This does not ring any bells, however I would suggest that you file a support
case. If it
is an option you might try a later release (7.0).
Bruce
Steve Alexander wrote:
Hi,
I currently have an EJB that returns a String[] array that I have implementedas
a Web Service. When I execute a Java client (JSP) from Weblogic, I don'thave a problem
as long as the returned array is relatively small, but when the arraystarts to get
a little larger (say 20 elements, about 30 chars each), I consistentlyget:
SAXException: java.lang.IllegalArgumentException:array element type mismatch.
Strangely enough, when my web service client is a .asp page running underMS IIS
(using the MS SOAP Toolkit), it works fine. I have returned as many as15000 - 20000
array elements in one call. And since I am calling the same Weblogic
EJB
with the
MS client, I know it's a problem with the Java client, not the EJB.
Anybody know of a bug or had this experience before? Or know what I mightbe doing
wrong? FYI, I am using Weblogic 6.1 SP2.
Thanks,
Steve -
How to return List or Array from Web Service without using ADF?
All,
I would like to know how to do this before I use ADF. Sounds like a simple thing to do - common even - but I haven't found a solution in existing postings. My attempts have failed though I'm not sure exactly why.
I have created a declarative WS that takes a single parameter and tries to return a List<Employees> resultset. My Sample Java Client works just fine. When I change the result type from List to String[], for example, it also works fine.
What am I doing wrong??
Thanks
package wizard;
(imports removed for readability)
@WebService(name = "MyWebService1", serviceName = "MyWebService1", portName = "MyWebService1SoapHttpPort")
@Deployment(restSupport = true)
public class HelloWorld {
List<Employees> employees = null;
public HelloWorld() {
public List<Employees> sayHello (String s) {
try {
final Context context = getInitialContext();
ATOABPFacade aTOABPFacade = (ATOABPFacade)context.lookup("ATOABPFacade");
employees = aTOABPFacade.queryEmployeesFindByName(s);
return employees;
} catch (Exception ex) {
ex.printStackTrace();
return employees;
private static Context getInitialContext() throws NamingException {
return new InitialContext();
Trace:
Ready message received from Oc4jNotifier.
Embedded OC4J Server startup time: 24063 ms.
Target URL -- http://localhost:8988/JPA-Wizard-context-root/mywebservice1soaphttpport
Feb 18, 2008 7:42:49 PM com.evermind.server.ServerBase log
WARNING: JPA-Wizard-webapp: Error preloading servlet
javax.servlet.ServletException: java.lang.NullPointerException
at oracle.j2ee.ws.server.provider.ProviderServlet.init(ProviderServlet.java:186)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2674)
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:5162)
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:5085)
at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:5275)
at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1357)
at com.evermind.server.http.HttpApplication.init(HttpApplication.java:873)
at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:699)Gi,
not sure what you are doing there, but you can build the J2EE WebService from your working POJO, and create a Web Service proxy class from the WSDL description (of the deployed or local WSDL file). Then, using the proxy class, you can access the output of the WebService.
Frank -
Return arrary of objects from web service
Hello ALL,
This problem has stumped me for several days.
I have a web service and a jsp client. the jsp client call the web service. the web service function return an array of object of DataBaseRecord type. I use XFire + MyEclipse + Tomcat to develop this project in a Linux box.
the web service WelcomeYou is defined as follows
{noformat}public List<DataBaseRecord> WelcomeYou(String ExampleDoc)
List<DataBaseRecord> RetrievalResult = new ArrayList<DataBaseRecord>();
// Search relevant documents according to 'ExampleDoc' from a database
// The search result will be put into a RecordSet object 'rs'
while(rs.next())
DataBaseRecord NewRecord = new DataBaseRecord ();
NewRecord.RetrievedDocID = rs.getString("RetrievalDocID");
NewRecord.SimiScore = Float.valueof(rs.getString("SimiScore"));
RetrievalResult.add(NewRecord );
// I use the following for loop to see the content of RetrievalResult. I can see that the content is just what I expect. Additionally, the size of RetrievalResult is correct too.
for(DataBaseRecord databaserecord : RetrievalResult)
System.out.println(databaserecord.RetrievedDocID + databaserecord.SimiScore);
return RetrievalResult;{noformat}in a jsp file, the web service WelcomeYou is called
{noformat}List<DataBaseRecord> Result = new List<DataBaseRecord>();
Result = srvc.WelcomeYou("some text ");
// I use the following for loop to see the contentof Result, but each element of Result is empty. Moreover, the strange thing is that the size of Result is right.
for(DataBaseRecord databaserecord : Result)
System.out.println(databaserecord.RetrievedDocID + databaserecord.SimiScore);
{noformat}the class DataBaseRecord is defined as follows
{noformat}public class DataBaseRecord{
public String RetrievedDocID;
public float SimiScore;
{noformat}At the very end of the service function body(just before ' return RetrievalResult;'), i check the content of RetrievalResult using a for loop, it is correct.
At the jsp file, immediately after the statement
{noformat} Result = srvc.WelcomeYou("some text ");
{noformat}
{code}
, i check the content of Result using a for loop, it is incorrect except for the size of Result .
I wonder where I am wrong in the above code.Can you show the UserProfile.java ? That may have some variables, which are not supported in web services.
-
Return List of object from web service
Hi to all.
I have a java class which returns an array of ojects (custom objects).
With jdeveloper tool i would like to create a ws around my class, but i receive this message:
Method getUsers: The following JavaBean parameters have property descriptors using types that do not have an XML Schema mapping and/or serializer specified:
Code is the following:
public class GETUSERS
//Costruttore di default
public GETUSERS(){}
public UserProfile[] getUsers(String LastName,String Name)
CallableStatement proc = null;
ResultSet rs = null;
UserProfile users[] = null;
int cont=0;
try
Connessione connessione = new Connessione();
Connection conn = connessione.getJNDIConnection();
if (conn != null )
proc = conn.prepareCall("{call procedure(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) }");
//Cursore di output
proc.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR);
proc.setInt(2,1);
proc.setInt(3,100);
proc.setString(4,null);
proc.setString(5,LastName);
proc.setString(6,Name);
proc.setString(7,null);
proc.setString(8,null);
proc.setString(9,null);
proc.setString(10,"n");
proc.setString(11,null);
proc.setString(12,null);
proc.executeQuery();
rs = (ResultSet)proc.getObject(1);
rs.last();
users= new UserProfile[rs.getRow()];
rs.beforeFirst();
while (rs.next())
users[cont].setUID(rs.getString(1));
users[cont].setName(rs.getString(2));
cont++;
rs.close();
proc.close();
catch(Exception ex)
System.out.println(ex.getMessage());
return users;
}Any idea?
ThanksCan you show the UserProfile.java ? That may have some variables, which are not supported in web services.
-
Issue of invoke wf_engine function from web service client.
hi,
I want to update work flow item attribute from web service client through soa gateway. but got the below exception:
Error Description Error occured while service was processing.
Error Details oracle.apps.fnd.soa.util.SOAException: ServiceProcessingError: Exception returned from JCA Service Runtime. file:/pim/oracle/DEV/inst/apps/DEV_pimenv/soa/PLSQL/1318/SETITEMATTRTEXT.wsdl [ SETITEMATTRTEXT_ptt::SETITEMATTRTEXT(InputParameters) ] - WSIF JCA Execute of operation 'SETITEMATTRTEXT' failed due to: Error while processing an API interaction execution. An error occurred while processing the interaction for invoking the WF_ENGINE.SETITEMATTRTEXT API. Cause: oracle.tip.adapter.apps.AppsContextValidationException: Cannot set Context ; nested exception is: ORABPEL-11812 Error while processing an API interaction execution. An error occurred while processing the interaction for invoking the WF_ENGINE.SETITEMATTRTEXT API. Cause: oracle.tip.adapter.apps.AppsContextValidationException: Cannot set Context Check to ensure that the XML containing parameter data matches the parameter definitions in the XSD. Contact oracle support if error is not fixable. at oracle.apps.fnd.soa.provider.services.jca.JCAHandler.invoke(JCAHandler.java:173) at oracle.apps.fnd.soa.provider.services.jca.JCAHandler.handleRequest(JCAHandler.java:120)
it indicate " cannot set context". but there is no method of wf_engine api to set it.
Thanks,
RockHi, Buddy,
Did you fix your issue?
Now, I have the same issue, EBS version is 12.1.3. Using Soapui invoking PL/SQL, then go back to SOA monitor to check the error message.
Could you please give me some advises?
Thanks,
Jackie -
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">*
*<copy>*
*<from variable="InvokeQAS_DoSearch_OutputVariable"*
part="body"
query="/ns6:QASearchResult/ns6:QAPicklist/ns6:PicklistEntry/@PostcodeRecoded"/>
*<to variable="temp"/>*
*</copy>*
*</assign>*
but, I am facing the following selectionFailure errors after running it:
*"{http://schemasxmlsoap.org/ws/2003/03/business-process/}selectionFailure" has been thrown.*
-<selectionFailure xmlns="http://schemasxmlsoap.org/ws/2003/03/business-process/">
-<part name="summary">
*<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.
*</summary>*
*</part>*
*</selectionFailure>*
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.
Chandrachur.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:sequence>
<xs:attribute name="VerifyLevel" type="qas:VerifyLevelType" default="None" />
</xs:complexType>
</xs:element>
<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:sequence>
<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>
<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:sequence>
<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" />
</xs:complexType>
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...!!!
Chandrachur. -
Error when calling BPEL process from web service client
I have created three projects here ,there're no problem when testing Composite Application(SynchronousSampleApplication) by test case inside this project.
When I create a Java Application(SynchronousSampleApp),inside this project I've created a web service client from file WSDL of BPEL. After that, In Main class, I call an operation from web service client.But have the following error:
Jul 17, 2008 4:48:22 PM synchronoussampleapp.Main main
SEVERE: null
java.rmi.RemoteException: HTTP transport error: java.net.MalformedURLException: For input string: "${HttpDefaultPort}"; nested exception is:
HTTP transport error: java.net.MalformedURLException: For input string: "${HttpDefaultPort}"
at SynSample.SynchronuosSamplePortType_Stub.synchronuosSampleOperation(SynchronuosSamplePortType_Stub.java:83)
at synchronoussampleapp.Main.main(Main.java:24)
Caused by: HTTP transport error: java.net.MalformedURLException: For input string: "${HttpDefaultPort}"
at com.sun.xml.rpc.client.http.HttpClientTransport.invoke(HttpClientTransport.java:140)
at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:96)
at SynSample.SynchronuosSamplePortType_Stub.synchronuosSampleOperation(SynchronuosSamplePortType_Stub.java:67)
... 1 more
Please help me soon. Thanks very much!Can't anyone help me? I'm using Netbean 6.1 and Glassfish server.
Do I need any additional plugin? -
Binding xml from web service to java objects
I would appreciate if someone can tell me where can i get information regarding
binding of xml from web service to java objects in weblogic 6.1 .
Thanks,
agHi Ag,
To my knowledge, the only information on this topic is whatever you find in the
documentation. What exactly do you want to know?
Can you post a set of specific questions?
Regards,
Mike Wooten
"ag" <[email protected]> wrote:
>
I would appreciate if someone can tell me where can i get information
regarding
binding of xml from web service to java objects in weblogic 6.1 .
Thanks,
ag -
How to create a proxy to retrieve the xml file from web services
Hi Every one,
We have a requirment where we receive a xml file from Kenexa, a third party HR tool using a middleware tool. from SAP side We have to create a proxy to retrieve the xml file from web services by initiating call through middleware tool i used earlier.
these are the steps i intend to follow to accomlish the requirement.
1) middleware tool has to initiate the call to kenexa web services to receive the xml file when it is available.
2) On SAP we need to create a ABAP Proxy service provider to middleware where this file can be received.
Can any one guide me how i can create a proxy to retrieve the xml file from web services by initiating call through other middlewre (its not PI).
Any help would be really great, i am not a ABAP developer, so please help me with this. Thanks.Thank for reply.
The computers are in different locations, but yes it's possible, the users in this enviroment are all local administrator of the machines, and we can distribute the script centrally from the DC automatically
Acrobat use Java, right? I'm not so expert in java, but something about it could not be so difficult to manage.
Do you know some place where i can get some info about JS and acrobat? -
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...
ThanksPlease post this question in the CRM On Demand Integration Development forum.
-
How to catch client information from web service server side?
Is there any possibilities to get the client information (any id or ipaddress or anything) from web service running server side(or in console)? I didn't get any idea how to catch this information. If someone knowing this, that would be great and appreciate that help.
hellloo to u tooooooo
if u r using any request object u will get the host ipaddress as
request.getRemoteHost() funciton
regards
shanu -
Error in testing XML query result set web service
Hi
I was trying to test a <b>XML query result set web service</b> in BW system with tcode wsadmin but getting error like
<b>Cannot download WSDL from http://ibmbtsb02.megacenter.de.ibm.com:8070/sap/bw/xml/soap/queyview?sap-client=001&wsdl=1.1&mode=sap_wsdl: F:\usr\sap\W70\DVEBMGS70\j2ee\cluster\server0\apps\sap.com\com.sap.engine.services.webservices.tool\servlet_jsp\wsnavigator\root\WEB-INF\temp\ws1139464945296\wsdls\wsdlroot.wsdl (The system cannot find the path specified)</b>
I had tried it first time few days ago and was able to test it successfully with the same configuration settings.
Could any one of you please provide any suggestion on this?
Thanks in advance
Sudiphi
check this links it may help u.
http://help.sap.com/saphelp_nw04/helpdata/en/c3/e3072e65f04445a010847aa970b68b/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/d8/3bfc3f8fc2c542e10000000a1550b0/frameset.htm
Regards,
Manoseelan -
Presence data from web service
Hello,
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 helpHi,
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.net.URI;
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;
/* PresenceDemoClient.java
* 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) {
System.out.println(e.toString());
// 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 +
"/aggregationproxy/presencesupplierws/presencesupplier");
System.out.println("Supplier URL: " + "http://" + PresenceServer + ":" +
PresencePort +
"/aggregationproxy/presencesupplierws/presencesupplier");
supplier.setMaintainSession(true);
supplier.setUsername(PresenceUsername);
supplier.setPassword(PresencePassword);
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;
else
activity = ActivityValue.ActivityNone;
PresenceAttribute pa = new PresenceAttribute();
AttributeTypeAndValue typeValue = new AttributeTypeAndValue();
typeValue.setActivity(activity);
if (Integer.parseInt(expires) == 0)
typeValue.setUnionElement(PresenceAttributeType.Other);
else
typeValue.setUnionElement(PresenceAttributeType.Activity);
CommunicationMeans mean = new CommunicationMeans();
System.out.println(new URI("sip:" + PresenceUsername + "@" +
PresenceRealm));
mean.setContact(new URI("sip:" + PresenceUsername + "@" +
PresenceRealm));
mean.setPriority(1);
mean.setType(CommunicationMeansType.Chat);
CommunicationValue commValue = new CommunicationValue();
commValue.setMeans(new CommunicationMeans[] { mean });
typeValue.setCommunication(commValue);
OtherValue other = new OtherValue();
other.setName("Expires");
other.setValue(expires);
typeValue.setOther(other);
typeValue.setPrivacy(PrivacyValue.PrivacyNone);
typeValue.setPlace(PlaceValue.PlaceNone);
typeValue.setSphere(SphereValue.SphereNone);
pa.setTypeAndValue(typeValue);
pa.setNote(note);
//Allowing all pending subscriptions
SubscriptionRequest[] srArray = supplier.getOpenSubscriptions();
for (SubscriptionRequest sr:srArray) {
URI watcher = sr.getWatcher().normalize();
/*System.out.println("Blocking: " + watcher);
supplier.blockSubscription(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;
supplier.updateSubscriptionAuthorization(watcher,permissions);*/
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();
pa.setLastChange(dateTime);
supplier.publish(new PresenceAttribute[] { pa });
System.out.println("Publish done: " + "sip:" + PresenceUsername + "@" +
PresenceRealm);
} catch (Exception e) {
System.out.println("Publish failed: " + e.toString());
e.printStackTrace();
// subscribePresence - this method subscribes to
// presence information of buddylist members
public void subscribePresence() {
try {
// create web services endpoint
consumer.setEndpoint("http://" + PresenceServer + ":" +
PresencePort +
"/aggregationproxy/presenceconsumerws/presenceconsumer");
System.out.println("Consumer URL: " + "http://" + PresenceServer + ":" +
PresencePort +
"/aggregationproxy/presenceconsumerws/presenceconsumer");
consumer.setMaintainSession(true);
consumer.setUsername(PresenceUsername);
consumer.setPassword(PresencePassword);
// 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.setCorrelator("unused_correlator");
sr.setInterfaceName("unused_interfacename");
sr.setEndpoint(new URI("http://unused.com"));
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",
sr);
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());
e.printStackTrace();
// 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){
System.out.println(str);
} 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("192.168.111.222","employee1","welcome1","vitkovice","8888",buddy_list);
client.publishPresence("Available",":)");
client.subscribePresence();
URI[] buddy_list2 = {new URI("sip:[email protected]"),new URI("sip:[email protected]"),new URI("sip:[email protected]")};
PresenceDemoClient client2 = new PresenceDemoClient("192.168.111.222","employee2","welcome1","vitkovice","8888",buddy_list2);
client2.publishPresence("Available",":)");
client2.subscribePresence();
URI[] buddy_list3 = {new URI("sip:[email protected]"),new URI("sip:[email protected]"),new URI("sip:[email protected]")};
PresenceDemoClient client3 = new PresenceDemoClient("192.168.111.222","employee3","welcome1","vitkovice","8888",buddy_list3);
client3.publishPresence("Available",":)");
client3.subscribePresence();
URI[] buddy_list4 = {new URI("sip:[email protected]"),new URI("sip:[email protected]"),new URI("sip:[email protected]")};
PresenceDemoClient client4 = new PresenceDemoClient("192.168.111.222","employee4","welcome1","vitkovice","8888",buddy_list4);
client4.publishPresence("Available",":)");
client4.subscribePresence();
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()); -
Hi,
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.
Example:
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?
ThxHi,
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
Regards,
Thomas
Maybe you are looking for
-
How to do a FTP from one system to another
Hi, I have a program which creates a file from the master data in one system (Logistics), and I have another program in another system (HR) which writes the contents from this file to a custom table. I want to the avoid manual movement of the file
-
Purchases from one Itunes to another?
On my old windows, I bought 2 seasons of a TV show, a few ipod touch apps and a movie - i logged into my itunes account on my new mac, and they're not there anymore, but show up on my purchase history. Is there any way to get them back?
-
Gathering daily statistics of a table using DBMS_STATS..!!
Hi all, Can please somebody help me for how to collect daily statistics of a table..!! executing the DBMS_stats is fine but when i assign as a job using OEM the job never starts. It just shows the status as job submitted but never executes.. Is there
-
What are the best editing softwares to create sequence shots and slow down video?, What are the best editing softwares to create sequence shots and slow down video?
-
How about a status update on mtu for zen xtra--i want napster to
hey creative, any word on the update for mtu support for the xtra? napster is announcing the official release of napster to go, but as it currently stands, you can only use it on the micro, not the touch or the xtra. for a number of months we have be