About Question enthuware.ocejws.v6.2.80 :
Moderators: Site Manager, fjwalraven
-
- Posts: 33
- Joined: Sat Nov 24, 2012 8:52 am
- Contact:
About Question enthuware.ocejws.v6.2.80 :
what does QName object indicate ?
I see, its being used twice in the client (one with reference serviceName and other with reference portName)
I tried to search the web , but could not find a clear answer.
I see, its being used twice in the client (one with reference serviceName and other with reference portName)
I tried to search the web , but could not find a clear answer.
-
- Posts: 429
- Joined: Tue Jul 24, 2012 2:43 am
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
QName represents a qualified name as defined in the XML specifications. The value of a QName contains a Namespace URI, local part and prefix.
Consider for instance the following QName:
Namespace URI = "http://ws.notes.nl/"
local part = getTableResponse
prefix = ns2
Regards,
Frits
Consider for instance the following QName:
Code: Select all
<ns2:getTableResponse xmlns:ns2="http://ws.notes.nl/">
local part = getTableResponse
prefix = ns2
Regards,
Frits
-
- Posts: 13
- Joined: Thu Apr 24, 2014 9:23 pm
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
one of the wrong answers say "MathTablePort should be MathTableService."
looks ok to me
also looks ok to me
please explain..
thank you.
Code: Select all
MathTableImplService service = new MathTableImplService();
Code: Select all
MathTablePort port = service.getMathTableImplPort();
please explain..
thank you.
-
- Posts: 429
- Joined: Tue Jul 24, 2012 2:43 am
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
Hi
This is not correct as the Service Endpoint Interface (SEI) is MathTableService.
The correct code looks like:
Regards,
Frits
Code: Select all
MathTablePort port = service.getMathTableImplPort();
The correct code looks like:
Code: Select all
MathTableImplService service = new MathTableImplService();
MathTableService port = service.getMathTableImplPort();
Frits
-
- Posts: 25
- Joined: Wed Jun 24, 2015 7:26 am
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
Hi, in code of fourth wrong answers:
you said:
There is no getPort()method without parameters.
1. but this is wrong because there is a method get...Port without parameters.
Is the name of the method is wrong because should be service.getMathTableImplPort()
Code: Select all
public class MathTableClient {
public static void main(String[] args) {
MathTableImplService service = new MathTableImplService();
MathTableService port = (MathTableService) service.[u]getPort()[/u];
try {
SimpleMathTable table = port.getTable(new Integer(5));
} catch (NegException e) {
}
}
}
There is no getPort()method without parameters.
1. but this is wrong because there is a method get...Port without parameters.
Is the name of the method is wrong because should be service.getMathTableImplPort()
-
- Posts: 25
- Joined: Wed Jun 24, 2015 7:26 am
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
Sorry, I double-checked your answer and you're rightfabiolino wrote:Hi, in code of fourth wrong answers:you said:Code: Select all
public class MathTableClient { public static void main(String[] args) { MathTableImplService service = new MathTableImplService(); MathTableService port = (MathTableService) service.[u]getPort()[/u]; try { SimpleMathTable table = port.getTable(new Integer(5)); } catch (NegException e) { } } }
There is no getPort()method without parameters.
1. but this is wrong because there is a method get...Port without parameters.
Is the name of the method is wrong because should be service.getMathTableImplPort()
-
- Posts: 25
- Joined: Wed Jun 24, 2015 7:26 am
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
In the code:
you said: You cannot create (or add) a port with name "MathTableImplPort" because it already exists.
but i just run the my method below on tomcat 7 (all artifacts are generated) and there are no errors in the response
Code: Select all
public class MathTableClient {
public static void main(String[] args) {
MathTableImplService service = new MathTableImplService();
QName portName = new QName("http://math.wsl/", "MathTableImplPort");
service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
"http://localhost:9999/math");
MathTableService port = service.getPort(portName,
MathTableService.class);
try {
SimpleMathTable table = port.getTable(new Integer(5));
} catch (NegException e) {
}
}
}
but i just run the my method below on tomcat 7 (all artifacts are generated) and there are no errors in the response
Code: Select all
private static void call2() {
service = new HelloWorld_Service();
QName portName = new QName("http://cxf.fabio.com/", "HelloWorldImplPort");
service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, "http://localhost:8080/jaxws/services/jaxws");
HelloWorld port = service.getPort(portName, HelloWorld.class);
service.setHandlerResolver(new ClientHandlerResolver());
System.out.println(port.sayHi("ciao"));
}
-
- Posts: 429
- Joined: Tue Jul 24, 2012 2:43 am
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
Interesting: what EE-server are you using?
-
- Posts: 25
- Joined: Wed Jun 24, 2015 7:26 am
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
Tomcat 7 + apache cxf and ws is a Servlet Endpoints
-
- Posts: 429
- Joined: Tue Jul 24, 2012 2:43 am
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
Maybe apache cxf ignores the addPort() method if the port already exists.
The API says:
The API says:
In other words: this method can only be used for a Dispatch client.addPort
Creates a new port for the service. Ports created in this way contain no WSDL port type information and can only be used for creating Dispatch instances.
-
- Posts: 124
- Joined: Wed Feb 12, 2014 2:44 am
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
Hello ,
You mentioned "There is no getPort()method without parameters."
But this is not correct , I have running code on netbeans with getPort without parameters.
Kindly explain.
You mentioned "There is no getPort()method without parameters."
But this is not correct , I have running code on netbeans with getPort without parameters.
Kindly explain.
-
- Posts: 429
- Joined: Tue Jul 24, 2012 2:43 am
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
I wonder how that is possible. The specs clearly mention a getPort with a minimum of one parameter:I have running code on netbeans with getPort without parameters.
Code: Select all
T getPort(Class<T> sei)
T getPort(QName port, Class<T> sei)
T getPort(Class<T> sei, WebServiceFeature... features)
T getPort(QName port, Class<T> sei, WebServiceFeature... features)
T getPort(EndpointReference epr, Class<T> sei, WebServiceFeature... features)
Frits
-
- Posts: 124
- Joined: Wed Feb 12, 2014 2:44 am
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
Hello ,
You are right , the function I have is get****port();
Sorry for any inconvenience.
You are right , the function I have is get****port();
Sorry for any inconvenience.
-
- Posts: 2
- Joined: Tue Feb 24, 2015 12:32 pm
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
Hello,
I think there's an error on the QName of the correct answer. A missing slash '/' at the end of the URI prevents the client from working correctly.
Please correct me if I am wrong. I did try of course.
I think there's an error on the QName of the correct answer. A missing slash '/' at the end of the URI prevents the client from working correctly.
Please correct me if I am wrong. I did try of course.
-
- Posts: 429
- Joined: Tue Jul 24, 2012 2:43 am
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
Hi !
Thanks for your feedback!
Regards,
Frits
Good catch! I have fixed it.think there's an error on the QName of the correct answer. A missing slash '/' at the end of the URI prevents the client from working correctly.
Thanks for your feedback!
Regards,
Frits
-
- Posts: 197
- Joined: Mon Jun 20, 2016 5:06 pm
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
Was MathTableImplPort created by this line of code?You cannot create (or add) a port with name "MathTableImplPort" because it already exists.
Code: Select all
QName portName = new QName("http://math.wsl/", "MathTableImplPort"); service.addPort(portName,
-
- Posts: 197
- Joined: Mon Jun 20, 2016 5:06 pm
- Contact:
-
- Posts: 429
- Joined: Tue Jul 24, 2012 2:43 am
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
Sorry, it seems I didn't get an e-mail when you replied to this question.
Regards,
Frits
No, it was created by wsimportWas MathTableImplPort created by this line of code?
Regards,
Frits
-
- Posts: 197
- Joined: Mon Jun 20, 2016 5:06 pm
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
How do you know that it was created by wsimport?
-
- Posts: 429
- Joined: Tue Jul 24, 2012 2:43 am
- Contact:
Re: About Question enthuware.ocejws.v6.2.80 :
The problem statement mentioned it "Assume that the artifacts are generated by wsimport." When you generate these artifacts you can see that the port is there (because that is what wsimport does for you)How do you know that it was created by wsimport?
Have you tried it yourself and verified the generated code?
Regards,
Frits
Who is online
Users browsing this forum: No registered users and 1 guest