- This topic has 13 replies, 6 voices, and was last updated 17 years, 9 months ago by nvenkatarao.
-
AuthorPosts
-
coolhongMemberI step by step to learn web services from the below URL….
http://myeclipseide.com/enterpriseworkbench/help/index.jsp?topic=/com.genuitec.myeclipse.doc/html/quickstarts/webservices/index.htmlfinally , i met a problem
It just give me the following code
public static void main(String[] args) { Service srvcModel = new ObjectServiceFactory().create(IHelloWorldService.class); XFireProxyFactory factory = new XFireProxyFactory(XFireFactory.newInstance().getXFire()); String helloWorldURL = "http://localhost:8080/HelloWorld/services/HelloWorldService"; try { IHelloWorldService srvc = (IHelloWorldService)factory.create(srvcModel, helloWorldURL); String result = srvc.example("hello world"); System.out.print(result); } catch (MalformedURLException e) { e.printStackTrace(); } }
copy and pase was useless~
i don’t know how to use these code to test client-side
anyone know the complete codes ?
plz tell me~many thanks
Riyad KallaMembercoolhong,
Did you follow Section 9 in the document above to generate that client? From there, once you have the service reference (srvc in this case) you can execute your method calls against it.I don’t understand the “copy and paste was useless”… you mean the example code didn’t work or you mean it didn’t do anything interesting? As far as interesting, it’s up to you to write an interesting method… maybe add a method to your web service that takes a number, then returns the number with 10 added to it, or something like that.
coolhongMemberI follow Section 9 definitely~
copy and pase means the following codepackage com.genuitec.myeclipse.wsexample.client; public class HelloWorldClient { /** * @param args */ public static void main(String[] args) { Service srvcModel = new ObjectServiceFactory().create(IHelloWorldService.class); XFireProxyFactory factory = new XFireProxyFactory(XFireFactory.newInstance().getXFire()); String helloWorldURL = "http://localhost:8080/HelloWorld/services/HelloWorldService"; try { IHelloWorldService srvc = (IHelloWorldService)factory.create(srvcModel, helloWorldURL); String result = srvc.example("hello world"); System.out.print(result); } catch (MalformedURLException e) { e.printStackTrace(); } } }
I knew i miss some ” import classes ” in the begining~
The intruction document just gives the segment code~
hence , i need complete code to make this example work .
many thanks~@support-rkalla wrote:
coolhong,
Did you follow Section 9 in the document above to generate that client? From there, once you have the service reference (srvc in this case) you can execute your method calls against it.I don’t understand the “copy and paste was useless”… you mean the example code didn’t work or you mean it didn’t do anything interesting? As far as interesting, it’s up to you to write an interesting method… maybe add a method to your web service that takes a number, then returns the number with 10 added to it, or something like that.
Riyad KallaMembercoolhong,
The code above is code that will read the example web service that you develop for steps 1-8 first. If you are asking how to develop a client in general, we don’t have a document specifically for that yet, but if you watch our new feature overview:
http://www.myeclipseide.com/images/tutorials/feature_overview/MEFO%20-%20Main%20-%20Low%20Quality.htmand click the “WS” link at the bottom of the movie and skip to that portion of it, that entire segment is a screen cast of developing a WS client for the Amazon Search Service.
coolhongMemberHi~Riyad
I followed the URL you gave ~
it work~ 🙂
many thanks~@support-rkalla wrote:
coolhong,
The code above is code that will read the example web service that you develop for steps 1-8 first. If you are asking how to develop a client in general, we don’t have a document specifically for that yet, but if you watch our new feature overview:
http://www.myeclipseide.com/images/tutorials/feature_overview/MEFO%20-%20Main%20-%20Low%20Quality.htmand click the “WS” link at the bottom of the movie and skip to that portion of it, that entire segment is a screen cast of developing a WS client for the Amazon Search Service.
Riyad KallaMemberI’m glad it helped.
Donald ScottParticipantimport org.codehaus.xfire.XFireFactory; import org.codehaus.xfire.client.XFireProxyFactory; import org.codehaus.xfire.service.Service; import org.codehaus.xfire.service.binding.ObjectServiceFactory; import java.net.MalformedURLException;
Lee HarringtonMember@donscott wrote:
import org.codehaus.xfire.XFireFactory; import org.codehaus.xfire.client.XFireProxyFactory; import org.codehaus.xfire.service.Service; import org.codehaus.xfire.service.binding.ObjectServiceFactory; import java.net.MalformedURLException;
Thanks — those imports are indeed needed and should be added to the documentation as simply following the steps does not work.
I built the service per the tutorial and tested with the Web Service Explorer and all went well. I’m trying the client portion of the tutorial, and after adding those imports and running I get the following message:
Exception in thread "main" org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Unexpected character '>' (code 62) expected '=' at [row,col {unknown-source}]: [1,708] org.codehaus.xfire.fault.XFireFault: Unexpected character '>' (code 62) expected '=' at [row,col {unknown-source}]: [1,708] at org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89) at org.codehaus.xfire.client.Client.onReceive(Client.java:386) at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:139) at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48) at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26) at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131) at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75) at org.codehaus.xfire.client.Client.invoke(Client.java:335) at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77) at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57) at $Proxy0.example(Unknown Source) at com.att.test.HelloWorldClient.main(HelloWorldClient.java:21) Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '>' (code 62) expected '=' at [row,col {unknown-source}]: [1,708] at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:600) at com.ctc.wstx.sr.BasicStreamReader.handleNsAttrs(BasicStreamReader.java:2880) at com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:2815) at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2737) at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1004) at org.codehaus.xfire.soap.handler.ReadHeadersHandler.invoke(ReadHeadersHandler.java:44) at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131) at org.codehaus.xfire.client.Client.onReceive(Client.java:382) ... 10 more
Here’s my “main” code:
public static void main(String[] args) { Service srvcModel = new ObjectServiceFactory().create(IHelloWorldService.class); XFireProxyFactory factory = new XFireProxyFactory(XFireFactory.newInstance().getXFire()); String helloWorldURL = "http://localhost:8080/HelloWorld/services/HelloWorldService"; try { IHelloWorldService srvc = (IHelloWorldService)factory.create(srvcModel, helloWorldURL); String result = srvc.example("hello world"); System.out.print(result); } catch (MalformedURLException e) { e.printStackTrace(); } } }
Thanks in advance,
Lee
tomekszMemberThis means that server returns incorect soap message. Check your server log for details or put tcpmon ( https://tcpmon.dev.java.net/ ) between client and server and see what is send over the wire.
Lee HarringtonMemberThanks….the problem was with the server — I rebuilt the server according to the steps in the documentation — plus fixes mentioned in the forums….and all is working. Well…stuck on hibernate, but that’s a new thread.
I think there’s an “opportunity” waiting for Genuitec to QC those helps and demo’s — nice as they are, when you can’t follow them step by step and have them work (like not mentioning the import statements) — it leads to a lot of frustration.
Lee
Riyad KallaMemberLee,
I’m just syncing back up with this thread, which tutorial or demo were you watching that excluded the import steps? Did you not get “Class not found” or “Unresolved import” errors in the editor before hand indicating the issue OR do you mean a generated class had unsufficient imports making it uncompilable right out of the gate (that would be a bug)
Lee HarringtonMember@support-rkalla wrote:
I’m just syncing back up with this thread, which tutorial or demo were you watching that excluded the import steps? Did you not get “Class not found” or “Unresolved import” errors in the editor before hand indicating the issue OR do you mean a generated class had unsufficient imports making it uncompilable right out of the gate (that would be a bug)
The info is in this thread — and the web client thread I started. I’ll start a new thread with a succinct writeup. The three demo’s I’ve tried this week (Web client, web services, hibernate 3.0) not a single one worked as directed in the writeup’s.
From h missing import statements — whether that’s a difeciancy in the doc or the generator — to missing transaction statements that would let your hibernate code actually save a record.
You know how big a booster I am of your product, so I’m not bashing here. It’s just that I’m using the tools in areas I don’t know so much about, so when I can’t follow the directions explicitly and have the code work — well, it’s quite frustrating.
Lee
Riyad KallaMemberI appreciate you taking the time Lee, I’ll do what I can to figure out if there is a bug in there or if the content needs to be amended.
nvenkataraoMember@support-rkalla wrote:
I appreciate you taking the time Lee, I’ll do what I can to figure out if there is a bug in there or if the content needs to be amended.
hi,
i have one wsdl file then i am creating webservice client, that is creating so many files and one test client java file…but the problem is when creating one file like
@XmlElementRef(name = “addr”, namespace = “http://service.ws.rs.com”, type = JAXBElement.class)
protected JAXBElement<String> addr;
protected Integer companyId;
@XmlElementRef(name = “companyName”, namespace = “http://service.ws.rs.com”, type = JAXBElement.class)
protected JAXBElement<String> companyName;
@XmlElementRef(name = “error”, namespace = “http://service.ws.rs.com”, type = JAXBElement.class)
protected JAXBElement<String> error;
@XmlElementRef(name = “state”, namespace = “http://service.ws.rs.com”, type = JAXBElement.class)
protected JAXBElement<String> state;/**
* Gets the value of the addr property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link String }{@code >}
*
*/
public JAXBElement<String> getAddr() {
return addr;
…….
} }that is created automatically above way……but i dont want JAXBElement<Stirng>…….if variable is string then i want create that is string varaible only i dont want JAXB element…….
how can i follow the steps can please any one let me know …
Thanks in Advance..
Thx,
Nelluri[/code]
-
AuthorPosts