Apache Axis2 throws NoSuchMethodError when trying to hit web service? - web-services

I am trying to hit the following web service with axis2: http://www.webservicex.net/geoipservice.asmx?WSDL
I have Axis2 locally, and I generated my classes by downloading the wsdl to my local drive and running:
./wsdl2java.sh -uri geoipservice.wsdl -p geoip -d xmlbeans -s -o geoip
This produced a build directory with a build.xml file in it, which i then ran "ant" in, and it produced a client jar in the libs folder.
I dropped this jar onto my classpath, and then I tried to hit the service using the following code:
GeoIPServiceStub stub = new GeoIPServiceStub("http://www.webservicex.net/geoipservice.asmx?WSDL");
GetGeoIPDocument req = GetGeoIPDocument.Factory.newInstance();
GetGeoIP gic = req.addNewGetGeoIP();
gic.setIPAddress("74.125.91.105"); // google.com
GetGeoIPResponseDocument resp = stub.getGeoIP(req);
System.out.println(resp.getGetGeoIPResponse().toString());
Things seem to run at first, and I see the results coming back in the syslog, but before it finishes it throws this exception:
java.lang.NoSuchMethodError: org.apache.axiom.om.impl.OMStAXWrapper.<init>(Lorg/apache/axiom/om/OMXMLParserWrapper;Lorg/apache/axiom/om/OMElement;Z)V
at org.apache.axiom.om.impl.llom.OMStAXWrapper.<init>(OMStAXWrapper.java:52)
at org.apache.axiom.om.impl.llom.OMElementImpl.getXMLStreamReader(OMElementImpl.java:795)
at org.apache.axiom.om.impl.llom.OMElementImpl.getXMLStreamReaderWithoutCaching(OMElementImpl.java:765)
at geoip.GeoIPServiceStub.fromOM(GeoIPServiceStub.java:767)
at geoip.GeoIPServiceStub.getGeoIP(GeoIPServiceStub.java:325)
I've googled all over and haven't been able to find what is causing this. Can anyone help me find what I'm doing wrong? Thank you.

You get NoSuchMethodErrors if your compiler used a different class definition (during compilation) to create your .class file then the jvm has at runtime.
In your case, it misses the constructor for org.apache.axiom.om.impl.OMStAXWrapper(org.apache.axiom.om.OMXMLParserWrapper, org.apache.axiom.om.OMElement)
It probably means you have the wrong org.apache.axiom library somewhere on your classpath.

Related

Failed to generate gRPC service classes

I am trying to follow along with this tutorial. I am stuck on trying to generate the .grpc files (service classes) but I was able to generate the message classes. When I run
protoc -I ../proto --grpc_out=.
--plugin=protoc-gen-grpc=grpc_cpp_plugin ../proto/eample.proto
I get "grpc_cpp_plugin: program not found". How can I generate the service classes? Im not sure about the correct command I have to run.
The question is pretty old, but I hope my answer will help somebody. Giorgio Azzinnaro was right you need to install GRPC (in addition to protoc). On OSX you can do it with:
brew install grpc
For the other languages, commands are described here
Can you try to run this?
$ which grpc_cpp_plugin
If it finds a match, try to use the full path:
--plugin=protoc-gen-grpc=`which grpc_cpp_plugin`
If that isn't found, see if it is there in /usr/local/bin (it might just not be in the path), and if you find it there again use the full path in the --plugin directive.
If all this fails I suppose it might be that gRPC was not installed correctly...

Load Angular2 Bootstrap template ng2-admin on Go server : download fail

I am new to this forum and a newbie in Angular2 and Golang.
My issue is that I would like to try out a template on a Go server.
So, I created a main.go file containing this main() function :
func main() {
r := mux.NewRouter()
p := http.StripPrefix("/", http.FileServer(http.Dir("./src/")))
n := http.StripPrefix("/config", http.FileServer(http.Dir("./config/")))
r.PathPrefix("/config/").Handler(n)
r.PathPrefix("/").Handler(p)
fmt.Printf("Starting server on :33166 \n")
http.ListenAndServe(":33166", r)
}
and run go run main.go on the project directory, but its fails in this request
GET http://127.0.0.1:33166/webpack-dev-server.js
It might be very simple, but I couldnot figure it out. So, any idea to how I'm able run the project on server would be appreciated. Thanks.
According to the ng2-admin installation guidelines, if you want to use ng2-admin with another backend (golang in your case), you need a release build using the following command:
npm run prebuild:prod && npm run build:prod
From installation guidelines:
This will clear up your dist folder (where release files are located), generate release build (...). Now you can copy the sources from a dist folder and use it with any backend framework or simply put it under some web server.
EDIT:
Thanks to #PatrickWalker for his comments.

Minko error building SDK

I am trying to compile the Minko framework on Windows 10 targeted at HTML. However, I'm hitting an error running the build_html5.bat script.
I've followed the instructions and completed all the steps (except for moving from the main branch to the dev branch, which is listed as optional). I cloned the source, set the new Environment Variable, ran the install_emscripten.bat file, and ran the specified commands in the emscripten command prompt.
However, when I try to run the build_html5.bat script, I get the following error:
I've looked in the MINKO_HOME directory and was able to find the jsoncpp.cpp file, but the jsoncpp.o file is not where in the directory specified in the command being called. The only file in MINKO_HOME/framework/obj/html5/release is a file named 'linker.rsp'.
I tried pulling down the dev branch into a different directory and updating the MINKO_HOME variable accordingly. I couldn't find the tool directory, but I was able to run the script scripts/solution_gmake_full.bat, after my first error trying to run build_html5_full.bat. When trying to run build_html5_full.bat, however, I get a different error:
Am I missing something here? Any help would be appreciated!
Sincerely,
Alex

Dajaxice not being parsed by template renderer?

Well i recently put my site into production and this is the last of a few bugs i need to fix. Basically dajaxice/dajaxice.core.js in returning this error in console Uncaught SyntaxError: Unexpected token %. I have placed that particular folder into static and run collect static. The file is fetched however upon opening up the file from the error the django code embedded within the file is not being rendered.
I have placed the file wihtin the head of my base file. Does anyone have any suggestions as to why this is occuring. In my local envionment (development) it is working flawlessly. The only difference i had when installing the two is that i used pip to install it on production and on local i directly downloaded the file and installed it from github. How do i find the version of Dajaxice that is installed?
Does anyone have any ideas as to why this is occuring?
Thanks

javax.xml.ws.WebServiceException: Port {http://tempuri.org/}WSHttpBinding_IDWService not found

I'm trying to consume a webservice in java, using a client generated from the wsdl file with wsdl2java.
I'm using Eclipse version Helios and jdk 1.6.0_20, and I've generated the .class files using wsld2java with the options:
"-d c:\WebServices\Generated -client -verbose -compile -autoNameResolution -p org.dwservice -sn DWService -wsdlLocation /WEB-INF/wsdl/DWService.wsdl c:\WebServices\DWService.wsdl"
I packed the resultant files into a .jar and added it to my project that compiles ok.
But when I try to use the webservice, I got the exception:
javax.xml.ws.WebServiceException: Port {http://tempuri.org/}WSHttpBinding_IDWService not found.
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:311)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:302)
at javax.xml.ws.Service.getPort(Service.java:92)
at org.dwservice.DWService.getWSHttpBindingIDWService(DWService.java:63)
And this is my code:
import org.dwservice.*;
...
private DWService dwService = new DWService();
private IDWService iDWService = ***dwService.getWSHttpBindingIDWService()***;
Any idea would be very much appreciated.
I know this post is over a year old, but it's a highly ranked search result for this error. I'm adding this answer for posterity.
Your wsdl2java command suggests your WSDL is local and you're packaging it into a web app. I suspect the app isn't finding the packaged WSDL at runtime. One option is to load it as a Java resource and pass its location into your service's constructor:
QName qname = new QName("my.name.space", "myName");
URL wsdlLocation = MyServiceClient.class.getResource("/WEB-INF/wsdl/DWService.wsdl");
dwService = new DWService(wsdlLocation, qname);
If you use this approach, triple-check the path to your WSDL. It's easy for getResource() to silently fail, which will produce the same error.