SoapRequest as xml string - java

I have been working on an Android app and calling a WCF C# web service. I can call one of the methods correctly but having problems calling the other. Just to make sure it works, is there any way that I can use the XML request (I know that this is the XML request which the web service requires) using KSoap2? That is, can I use the XML Request as a string and set it as a parameter in order to pass that string request up to the web service, to see if I can add data to a database through the web service?

For anyone that's interested, the following post helped me solve the problem
http://mobileorchard.com/android-app-development-calling-web-services/

Related

QuickBooks java SOAP Web Connector structure

i have inherited a java app that integrates with desktop QB. There's something in the structure of this whole setup i'm not understanding. This is my first go with the QB api as a developer.
the QB Web Connector 2.2.0.71 is installed and functional. I see the .qwc file and understand it, and it is loaded into the web connector. There is an Application class that publishes an endpoint to the same URL as in the .qwc file and then starts a class named QBWebService. this web service class implements com.intuit.developer.TroubleshootWebServiceFSSoap and has methods authenticate, sendRequestXML, etc. Method sendRequestXML has the code i am testing and attempting to modify. but, before i can do that i need to understand the XML going back and forth.
since i don't know what i don't know, if i'm asking the wrong questions, by all means, please say so.
is it correct, then, that the web connector (on schedule) launches the application class and calls the sendRequestXML method?
i was expecting to find a URL that i could send XML to with something like SOAPui in order to test the XML and examine the response, but that doesn't seem to be how this web service works. is it possible to set it up this way?
perhaps i don't understand what the QB web connector application is doing. what is the purpose of opening up the URL on localhost if it can't accept XML via POST?
thanks in advance for the help
--matt
is it correct, then, that the web connector (on schedule) launches the application class and calls the sendRequestXML method?
Yes, that's correct.
i was expecting to find a URL that i could send XML to with something like SOAPui in order to test the XML and examine the response
You can send requests to your SOAP service (e.g. you can call the sendRequestXML method for example).
You'll get back an XML response that (if you were the Web Connector) you would then relay to QuickBooks. QuickBooks would process the response, and then call the receiveResponseXML method to send the XML response back up to your web service.
perhaps i don't understand what the QB web connector application is doing.
It sounds like you're expecting QuickBooks to provide a SOAP endpoint, which you can then directly send XML requests to to query data directly from QuickBooks.
This is not really how the Web Connector works. The Web Connector sort of works "backwards".
Instead of connecting directly to QuickBooks, the Web Connector connects to you (your SOAP endpoint) and asks you "Hey, give me something to do!" (i.e. send me the request XML you want to run against QuickBooks). You then give it an XML request, which it runs against QuickBooks, gets the response, and then connects to you again and says "here's what QuickBooks responded to your request with" (i.e. here you go, receive this response XML from QuickBooks).
So the Web Connector essentially polls a SOAP endpoint you provide, asking you to give it XML requests to pass through to QuickBooks.
Longer explanation here:
http://www.consolibyte.com/docs/index.php/QuickBooks_Web_Connector_Overview#About_the_QuickBooks_Web_Connector

Creating SOAP WS in Java and get the request as a String

I was wondering if it was actually possible to create a Java SOAP Webservice without using it's WSDL.
Context:
The idea is that I have to mock a webservice, so I have its WSDL. The mock will only read the soap request, search if there are any similar request (as key in a map) and send the matching response (as its value). This is for automated testing purpose. The problem is not the "map" part.
Anyway, I've been using Axis and eclipse to generate classes and files and load them in tomcat from the WSDL. So far it've been a mess, with a lot of compatibility issues between these components. And it's gonna be much more difficult to compare the input or serialize the output to do what I want this way.
I thought about creating a REST endpoint and send the soap request through it (so I would directly get the SOAP request !), but I rode somewhere that soap request weren't valid and wouldn't be retreived by the REST endpoint... Also, won't the client application throw an error if there is no WSDL at this address ?
My question is:
Is there a way to create an access point, that looks like a SOAP Webservice (from clients), but which allows me to get the full soap request (as a String for example) and send a response (still as a String) inside a Java app?
Complements:
I'm looking for something, a library, maybe just an annotation on Servlets, that doesn't needs (if possible) to generate a huge load of classes and xml files everywhere. The app would be running on tomcat (but I can be a basic Java app). Using maven and spring wouldn't be a problem.
Thanks in advance !
Normally, clients do not require an WSDL. But it is a nice feature - use a normal servlet and handle the "?WSDL" manually. Then use some simple XPath or parse logic to extract the payload as a DOM document.

Use C# or VBA to call Jersey JAX-RS REST Webservice

I have a Jersey REST webservice and it works fine with java client. Now I'm wondering is it possible to use C# or VBA to call this webservice? Sorry I am new to C#/VBA. I am trying to create a add-in for excel. As far as I know I can use these two to create add-in. So my questions are:
What's the best way to create add-in in excel for getting/uploading data? Is Java possible? Or should I use C#?
If I use C#, is it possible to call java webservice in C#? I want to upload data via this webservice.
Thanks in advance.
Anything that can build an HTTP request matching the input expected for your Jersey REST service will work. JAX-WS and JAX-RS services are going to be exposed as agnostic access points for anything which can send an XML/JMS or HTTP request. You can confirm this by simply opening the endpoint in your web browser and trying to submit some GET requests that way.
That is the beauty of web services, they SHOULD be language agnostic. Basically you are just calling a url to return you some xml/json data which c# can handle.

WSDL2JAVA for simple http get on php page?

I have to request a PHP page with 3 Parameters (e.g. www.test.com/index.php?name=mrTest&no=1&id=10001). I'm using WSDL2JAVA for other Services and am now wondering if it is possible to generate a similar Service for this case. This PHP page Returns an XML. I'm just consumer/client of the Service.
I could also make a simple request and then use JAXB to parse the XML but i would like to implement all my Services the same way.
So, does anybody has already implement a php page consumer using WSDL2JAVA?
Best regards
So from my understanding this is a simple PHP page not a SOAP service. Remember XML is just the protocol used in a SOAP service however a SOAP service consists out of a WSDL that is published describing operations and how to call those operations.
A simple PHP page even if it returns XML data is NOT a SOAP service and thus does NOT have a WSDL. You wont be able to use WSDL2JAVA for that.
This PHP page seems more like a REST type service that returns XML instead of JSON. To be honest it really sounds like a REST service.
Try using the latest SOAPUI to connect to the page and see if you can use the REST project type with this page. If it is a REST service it might have a WADL file. YOu can use the WADL2JAVA cxf utility to generate classes to you. HOwever this is a BIG might as most REST services dont use WADL's yet. See this link on CXF

Calling Java RESTful webservice in Android

i have created a Java Restful Web service. Now i want to access it in Android. There are different methods in Webservice. Web service is running on http://192.15.10.62:8080.
how should i call a method named getGreetingMsg() in webservice which take a string argument and return a simple String message.
Web service Details
Project name RestFulWS
package Name rest.ws.server
class Name helloAndroid
Method Name getGreetingMsg(string argument)
any help will be appreciated.
Simply with an HTTP client like AndroidHttpClient.
EDIT: RESTful web service is accessible through URL like:
http://yourserver/someservice/<categoryID>/<objectID>
So, you can test your webservice from a web browser like Internet Explorer or Mozilla Firefox.
Then, on Android, use HTTP Get request and the AndroidHttpClient.
Don't forget to set the INTERNET permission in your AndroidManifest.xml too
It depend on the Web server you are using because each type of server will have its own URL to service hosted on it. If you are using JBOSS server then your URL looks like this
IP:PORT/projectname/webservicename/method name
Sounds like you're not sure how to approach your own API. If your API supports GET, then open a web browser and try some GET commands. Once you have a GET statement working, work through this tutorial: http://sarangasl.blogspot.com/2011/06/android-login-screen-using-httpclient.html.
Once you're set with POST, turn off GET in your webserver.
Good luck!
db

Categories