Foren
addMessage via Web Services
Olaf Keding, geändert vor 15 Jahren.
addMessage via Web Services
New Member Beiträge: 5 Beitrittsdatum: 21.10.08 Neueste Beiträge
Hi,
I am developing an application which makes a lot of use of the Liferay SOAP Web Services, using the Web Services Client Java Stubs for Liferay Services (download form liferay.com)
So far, it has gone pretty well, I have been able to add users and access all kind of information. When it comes to to using the MB_MBMessageService "addMessage" function, however, I get the following error using both my client and SoapUI:
My Code is as follows:
the "addMessage" method takes the following arguments:
I have tried everything and searched the web high and low without result, so I hope someone here can help me out.
I am developing an application which makes a lot of use of the Liferay SOAP Web Services, using the Web Services Client Java Stubs for Liferay Services (download form liferay.com)
So far, it has gone pretty well, I have been able to add users and access all kind of information. When it comes to to using the MB_MBMessageService "addMessage" function, however, I get the following error using both my client and SoapUI:
{http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode:
faultString: org.xml.sax.SAXException: Bad types (boolean -> double)
faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}hostname:itab2e01
org.xml.sax.SAXException: Bad types (boolean -> double)
My Code is as follows:
public boolean addComment(long threadId, String body){
Portlet_MB_MBMessageServiceSoapBindingStub ms = this.connectMessageService();
ms.setUsername(actingUserId);
ms.setPassword(actingUserPassword);
long categoryId = 0;
String subject = "N/A";
Object[] files = {};
boolean annonymous = false;
double priority = Double.valueOf(0.00);
String[] tagEntries ={};
boolean addCommunityPermission = false;
boolean addGuestPermission = false;
try {
ms.addMessage(categoryId, subject, body, files, annonymous, priority,
tagEntries, addCommunityPermission, addGuestPermission);
return true;
} catch (RemoteException ex) {
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
return false;
}
}
the "addMessage" method takes the following arguments:
public MBMessageSoap addMessage(long categoryId, long threadId,
long parentMessageId, String subject, String body, Object[] files, boolean anonymous,
double priority, String[] tagsEntries, boolean addCommunityPermissions, boolean
addGuestPermissions)
I have tried everything and searched the web high and low without result, so I hope someone here can help me out.
Mark Renton, geändert vor 15 Jahren.
RE: addMessage via Web Services
New Member Beiträge: 17 Beitrittsdatum: 24.06.07 Neueste Beiträge
Maybe via SOAP?
Something like this
Something like this
public static boolean addComment(long threadId, String body)
throws AxisFault {
MBMessageServiceSoapServiceLocator resourceServiceSoapServiceLocator =
new MBMessageServiceSoapServiceLocator();
try {
MBMessageServiceSoap serviceSoap;
serviceSoap = resourceServiceSoapServiceLocator
.getPortlet_MB_MBMessageService(_getURL("Portlet_MB_MBMessageService"));
long categoryId = 0;
String subject = "N/A";
Object[] files = {};
boolean annonymous = false;
double priority = Double.valueOf(0.00);
String[] tagEntries = {};
boolean addCommunityPermission = false;
boolean addGuestPermission = false;
serviceSoap.addMessage(categoryId, subject, body, files,
annonymous, priority, tagEntries, addCommunityPermission,
addGuestPermission);
return true;
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
Olaf Keding, geändert vor 15 Jahren.
RE: addMessage via Web Services
New Member Beiträge: 5 Beitrittsdatum: 21.10.08 Neueste Beiträge
Hi Mark,
thanks for the quick answer. Your post did not help me any further though, the problen lies not in the way I connect to the webservice. I use my own method (this.connectMessageService();) I can use the MB_MessageService perfectly well for getting Messages.
The method looks like this:
I reckon the probelm is rather that the axis deserializer thinks that the double priority is a boolean for some weird reason.
Or am I on the wrong track here?
It can't be authentication or user rights because I use the super-adim credentials (test@liferay.com) and as I said, adding a user has not been a problem.
thanks for the quick answer. Your post did not help me any further though, the problen lies not in the way I connect to the webservice. I use my own method (this.connectMessageService();) I can use the MB_MessageService perfectly well for getting Messages.
The method looks like this:
private Portlet_MB_MBMessageServiceSoapBindingStub connectMessageService(){
try {
String serviceName = "Portlet_MB_MBMessageService";
String bindUrl = baseUrl+serviceName;
MBMessageServiceSoapServiceLocator messageSoap
= new MBMessageServiceSoapServiceLocator();
messageSoap.setPortlet_MB_MBMessageServiceEndpointAddress(bindUrl);
Portlet_MB_MBMessageServiceSoapBindingStub messageService;
messageService = new Portlet_MB_MBMessageServiceSoapBindingStub();
try {
messageService = (Portlet_MB_MBMessageServiceSoapBindingStub)
messageSoap.getPortlet_MB_MBMessageService();
return messageService;
} catch (ServiceException ex) {
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
System.out.println("Probleme beim Verbinden mit dem Message Service");
return null;
}
}catch (AxisFault ex) {
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
System.out.println("Probleme beim kreieren des Message Service Service");
return null;
}
}
I reckon the probelm is rather that the axis deserializer thinks that the double priority is a boolean for some weird reason.
Or am I on the wrong track here?
It can't be authentication or user rights because I use the super-adim credentials (test@liferay.com) and as I said, adding a user has not been a problem.
Dipesh I Kamdar, geändert vor 15 Jahren.
RE: addMessage via Web Services
New Member Beiträge: 7 Beitrittsdatum: 11.12.08 Neueste Beiträge
Did you find Soulation? I am having same issue.
Olaf Keding, geändert vor 15 Jahren.
RE: addMessage via Web Services
New Member Beiträge: 5 Beitrittsdatum: 21.10.08 Neueste Beiträge
Hi Dipesh,
I did not find any, but the solution would be to write your own, non-buggy, MessageService, check out this thread:
http://www.liferay.com/web/guest/community/forums/-/message_boards/message/1566803
I just used an ugly work-around to add messages though cause I didn't have the time to go too deep into Liferay code...
regards,
Olaf
I did not find any, but the solution would be to write your own, non-buggy, MessageService, check out this thread:
http://www.liferay.com/web/guest/community/forums/-/message_boards/message/1566803
I just used an ugly work-around to add messages though cause I didn't have the time to go too deep into Liferay code...
regards,
Olaf
Edgar Tanaka, geändert vor 13 Jahren.
RE: addMessage via Web Services
New Member Beiträge: 4 Beitrittsdatum: 24.11.10 Neueste Beiträge
I am using addMessage and for the 'priority' parameter I pass only zero.
It is working for me.
It goes like this addMessage(<other params>, 0, <other params>);
It is working for me.
It goes like this addMessage(<other params>, 0, <other params>);