Good day.
I am still new to Ofbiz and need some help/suggestions regarding calling services (as webservices) that need Deserializing. My aim is to be able to call ofbiz services from an external server. In my investigation into this, I used the createUserLogin service in Ofbiz to test this. It works fine, when I try to create a new userlogin, but when I try to create a user login that already exists, an errorMesssageList is returned that causes the following exception on the external server: org.xml.sax.SAXException: Deserializing parameter 'errorMessageList': could not find deserializer for type {http://www.w3.org/2001/XMLSchema}any How do I deserialize the errorMessageList parameter? Any help/suggestions will be appreciated since I am also new to SOAP services. Here is the steps and code that I used: 1. Export the createUserLogin service in Ofbiz by setting export=true. This makes the service available as a SOAP service. To force authentication on user creation, the auth=true parameter was added. <service name=createUserLogin engine=java auth=true location=org.ofbiz.common.login.LoginServices invoke=createUserLogin export=true> <description>Create a UserLogin</description> <attribute name=userLoginId type=String mode=IN optional=false/> <attribute name=enabled type=String mode=IN optional=true/> <attribute name=currentPassword type=String mode=IN optional=false/> <attribute name=currentPasswordVerify type=String mode=IN optional=false/> <attribute name=passwordHint type=String mode=IN optional=true/> <attribute name=requirePasswordChange type=String mode=IN optional=true/> <attribute name=externalAuthId type=String mode=IN optional=true/> <attribute name=partyId type=String mode=IN optional=true/> </service> 2. Call the SOAP service from the external server by using Axis: Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(new URL(http://localhost:8080/webtools/control/SOAPService)); //this will be an external url. local for testing QName queryName = new QName(createUserLogin,createUserLogin); call.setOperationName(queryName); call.addParameter(userLoginId, org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.addParameter(currentPassword, org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.addParameter(currentPasswordVerify, org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.addParameter(login.username, org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.addParameter(login.password, org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.setReturnType(org.apache.axis.Constants.XSD_ANY); try{ Object response = call.invoke(new Object[]{louis17,pass111111,pass111111,admin,ofbiz}); System.out.println(Response of creating a user + response); } catch (Exception e){ System.out.println(error + e.getMessage()); } 3. If the user doesn't exist yet, a success message is returned. If the user already exists the following exception on the external server occurs: ERROR [org.apache.axis.client.Call] Exception: org.xml.sax.SAXException: Deserializing parameter 'errorMessageList': could not find deserializer for type {http://www.w3.org/2001/XMLSchema}any at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:277) at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035) at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165) at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141) at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236) at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384) at org.apache.axis.client.Call.invoke(Call.java:2467) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at za.co.A3P_seam.action.OFBIZWSClient.testUserAuthentication(OFBIZWSClient.java:130) at za.co.A3P_seam.action.OFBIZWSClient.main(OFBIZWSClient.java:23) error ; nested exception is: org.xml.sax.SAXException: Deserializing parameter 'errorMessageList': could not find deserializer for type {http://www.w3.org/2001/XMLSchema}any How do I get pass this problem, since I would rather by able to see on the client side the cause of the error - Could not create login user: user with ID louis17 already exists. How do I deserialize errorMessageList? Any help would be appreciated. Regards. Louis Engelbrecht -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. |
Administrator
|
Look for SOAP into FAQ. Notably
http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP+using+AXIS2 I have still to integrate it in OFBiz, but it's not my priority... Jacques From: "Louis Engelbrecht" <[hidden email]> Good day. I am still new to Ofbiz and need some help/suggestions regarding calling services (as webservices) that need Deserializing. My aim is to be able to call ofbiz services from an external server. In my investigation into this, I used the createUserLogin service in Ofbiz to test this. It works fine, when I try to create a new userlogin, but when I try to create a user login that already exists, an errorMesssageList is returned that causes the following exception on the external server: org.xml.sax.SAXException: Deserializing parameter 'errorMessageList': could not find deserializer for type {http://www.w3.org/2001/XMLSchema}any How do I deserialize the errorMessageList parameter? Any help/suggestions will be appreciated since I am also new to SOAP services. Here is the steps and code that I used: 1. Export the createUserLogin service in Ofbiz by setting export=true. This makes the service available as a SOAP service. To force authentication on user creation, the auth=true parameter was added. <service name=createUserLogin engine=java auth=true location=org.ofbiz.common.login.LoginServices invoke=createUserLogin export=true> <description>Create a UserLogin</description> <attribute name=userLoginId type=String mode=IN optional=false/> <attribute name=enabled type=String mode=IN optional=true/> <attribute name=currentPassword type=String mode=IN optional=false/> <attribute name=currentPasswordVerify type=String mode=IN optional=false/> <attribute name=passwordHint type=String mode=IN optional=true/> <attribute name=requirePasswordChange type=String mode=IN optional=true/> <attribute name=externalAuthId type=String mode=IN optional=true/> <attribute name=partyId type=String mode=IN optional=true/> </service> 2. Call the SOAP service from the external server by using Axis: Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(new URL(http://localhost:8080/webtools/control/SOAPService)); //this will be an external url. local for testing QName queryName = new QName(createUserLogin,createUserLogin); call.setOperationName(queryName); call.addParameter(userLoginId, org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.addParameter(currentPassword, org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.addParameter(currentPasswordVerify, org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.addParameter(login.username, org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.addParameter(login.password, org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.setReturnType(org.apache.axis.Constants.XSD_ANY); try{ Object response = call.invoke(new Object[]{louis17,pass111111,pass111111,admin,ofbiz}); System.out.println(Response of creating a user + response); } catch (Exception e){ System.out.println(error + e.getMessage()); } 3. If the user doesn't exist yet, a success message is returned. If the user already exists the following exception on the external server occurs: ERROR [org.apache.axis.client.Call] Exception: org.xml.sax.SAXException: Deserializing parameter 'errorMessageList': could not find deserializer for type {http://www.w3.org/2001/XMLSchema}any at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:277) at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035) at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165) at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141) at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236) at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384) at org.apache.axis.client.Call.invoke(Call.java:2467) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at za.co.A3P_seam.action.OFBIZWSClient.testUserAuthentication(OFBIZWSClient.java:130) at za.co.A3P_seam.action.OFBIZWSClient.main(OFBIZWSClient.java:23) error ; nested exception is: org.xml.sax.SAXException: Deserializing parameter 'errorMessageList': could not find deserializer for type {http://www.w3.org/2001/XMLSchema}any How do I get pass this problem, since I would rather by able to see on the client side the cause of the error - Could not create login user: user with ID louis17 already exists. How do I deserialize errorMessageList? Any help would be appreciated. Regards. Louis Engelbrecht -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. |
Free forum by Nabble | Edit this page |