[JBossWS] - Re: Urgent Help requested ...support for enums..update jboss
by joshua_hj
Hi,
I was trying to develop a parlay X web service, the MultimediaMessaging one. I have managed to generate all java classes from the wsdl and xsd files provided by the specification. Allthough, i am having a problem with enumerations. I have a type, named "MessagePriority" (see below) that is mapped into a java enum file "MessagePriority" (see below) . JBoss complains about the Enumeration type at deploy time. When i remove the references to that type it works fine.
Does the generated code below is supported by JBossWS?
Can i use enumeration at all?
PS: Can you explain better how did you managed to get your enums work
Best Regards Joshua
|
| EXCEPTION
|
| 23:31:27,785 ERROR [MainDeployer] Could not create deployment: file:/C:/Java/jboss-4.0.5.GA/server/all/deploy/MultimediaMessaging.war
| org.jboss.ws.WSException: JAX-RPC Enumeration type did not conform to expectations
| at org.jboss.ws.tools.schema.SchemaTypeCreator.handleJAXRPCEnumeration(SchemaTypeCreator.java:374)
| at org.jboss.ws.tools.schema.SchemaTypeCreator.generateNewType(SchemaTypeCreator.java:317)
| at org.jboss.ws.tools.schema.SchemaTypeCreator.getType(SchemaTypeCreator.java:273)
| at org.jboss.ws.tools.schema.SchemaTypeCreator.generateType(SchemaTypeCreator.java:132)
| at org.jboss.ws.tools.schema.SchemaTypeCreator.generateType(SchemaTypeCreator.java:127)
| at org.jboss.ws.tools.schema.SchemaTypeCreator.createFieldParticle(SchemaTypeCreator.java:607)
| at org.jboss.ws.tools.schema.SchemaTypeCreator.introspectJavaProperties(SchemaTypeCreator.java:592)
|
| ##############################
| ##############################
|
| SCHEMA
|
| <xsd:simpleType name="MessagePriority">
| <xsd:restriction base="xsd:string">
| <xsd:enumeration value="Default"/>
| <xsd:enumeration value="Low"/>
| <xsd:enumeration value="Normal"/>
| <xsd:enumeration value="High"/>
| </xsd:restriction>
| </xsd:simpleType>
|
|
| ##############################
| ##############################
|
| JAVA
|
| @XmlEnum
| public enum MessagePriority {
|
| @XmlEnumValue("Default")
| DEFAULT("Default"),
| @XmlEnumValue("High")
| HIGH("High"),
| @XmlEnumValue("Low")
| LOW("Low"),
| @XmlEnumValue("Normal")
| NORMAL("Normal");
| private final String value;
|
| MessagePriority(String v) {
| value = v;
| }
|
| public String value() {
| return value;
| }
|
| public static MessagePriority fromValue(String v) {
| for (MessagePriority c: MessagePriority.values()) {
| if (c.value.equals(v)) {
| return c;
| }
| }
| throw new IllegalArgumentException(v.toString());
| }
|
| }
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983950#3983950
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983950
18 years, 1 month
[JBossWS] - Re: TCP/IP settings for Web Service Client?
by tgoepferd
Here is the TCPDump output when it is working correctly. There are many examples of this:
Initial 3-way handshake
| SYN
| 18:01:30.769521 IP alpha.abc.com.58548 > 163.130.1.201.http: S 4126902008:4126902008(0) win 5840 <mss 1460,sackOK,timestamp 3028392681 0,nop,wscale 2>
| SYN-ACK
| 18:01:30.918689 IP 163.130.1.201.http > alpha.abc.com.58548: S 63388846:63388846(0) ack 4126902009 win 8760 <mss 1460,eol>
| ACK
| 18:01:30.918721 IP alpha.abc.com.com.58548 > 163.130.1.201.http: . ack 1 win 5840
|
| POST - First half of message
| 18:01:30.919050 IP alpha.abc.com.58548 > 163.130.1.201.http: . 1:1461(1460) ack 1 win 5840
| Continuation - 2nd Half of Message with push flag
| 18:01:30.919074 IP alpha.abc.com > 163.130.1.201.http: P 1461:1779(318) ack 1 win 5840
|
| TCP level ACK
| 18:01:31.101948 IP 163.130.1.201.http > alpha.abc.com.58548: . ack 1779 win 64240
| ACK Resent????, (Final Flag set)
| 18:01:31.387309 IP 163.130.1.201.http > alpha.abc.com.58548: F 204:204(0) ack 1779 win 64240
| handshake... we got your ack.
| 18:01:31.387342 IP alpha.abc.com.58548 > 163.130.1.201.http: . ack 1 win 5840
|
|
| 202 Accepted - (Final Flag set)
| 18:01:34.428663 IP 163.130.1.201.http >alpha.abc.com.58548: FP 1:204(203) ack 1779 win 64240
| Got your 202
| 18:01:34.469118 IP alpha.abc.com.58548 > 163.130.1.201.http: . ack 205 win 6432
|
| Bye - Closing Connection
| 18:02:53.064082 IP alpha.abc.com.58548 > 163.130.1.201.http: F 1779:1779(0) ack 205 win 6432
| Bye - Ack connection closing.
| 18:02:53.211680 IP 113.130.1.201.http > alpha.abc.com.58548: . ack 1780 win 64240
Here is an example of one where the 2nd half of the message is delayed by 5 seconds:
Initial 3 way handshake... SYN was resent after 3 seconds.
| 18:00:44.099506 IP alpha.abc.com.58525 > 163.130.1.201.http: S 4080391120:4080391120(0) win 5840 <mss 1460,sackOK,timestamp 3028345997 0,nop,wscale 2>
| 18:00:47.099218 IP alpha.abc.com.58525 > 163.130.1.201.http: S 4080391120:4080391120(0) win 5840 <mss 1460,sackOK,timestamp 3028348998 0,nop,wscale 2>
| 18:00:47.286140 IP 163.130.1.201.http > alpha.abc.com.58525: S 4104645:4104645(0) ack 4080391121 win 8760 <mss 1460,eol>
| 18:00:47.286188 IP alpha.abc.com.58525 > 163.130.1.201.http: . ack 1 win 5840
|
|
| POST - First Half of Message
| 18:00:47.286588 IP alpha.abc.com.58525 > 163.130.1.201.http: . 1:1461(1460) ack 1 win 5840
| 2nd Half of message
| 18:00:52.286766 IP alpha.abc.com.58525 > 163.130.1.201.http: FP 1461:1774(313) ack 1 win 5840
| 18:00:52.432341 IP 163.130.1.201.http > alpha.abc.com.58525: . ack 1775 win 63927
| 202 Accepted
| 18:00:52.433752 IP 163.130.1.201.http > alpha.abc.com.58525: P 1:204(203) ack 1775 win 63927
| Reset COnnection
| 18:00:52.433780 IP alpha.abc.com.58525 > 163.130.1.201.http: R 4080392895:4080392895(0) win 0
| AcK with /Final
| 18:00:52.434478 IP 163.130.1.201.http > alpha.abc.com.58525: F 204:204(0) ack 1775 win 63927
| Reset Connection
| 18:00:52.434501 IP alpha.abc.com.58525 > 163.130.1.201.http: R 4080392895:4080392895(0) win 0
NOTE: I am no TCP guru.... so I am not sure if my comments between the messages are accurate. However, from the message body, I could tell which packets contianed the SOAP messages.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983870#3983870
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983870
18 years, 1 month
[JBossWS] - org.jboss.remoting.CannotConnectException: Can not connect h
by jgilbert
I am trying to call a secured web service from a SLSB. I have injected the port using @Resource but get a connection exception because the credentials are not set. I have come up with a workaround to propagate the credentials (see below). But I would like to know if there is a standards based way to propagate credentials to the jaxrpc stub.
Do I just need to wait for the full JaxWS implementation in JBossWS 2.0?
@Stateless
| @RolesAllowed(value = { "User" })
| @SecurityDomain("portal")
| public class AuthorizationCallbackServiceAdapterBean implements AuthorizationCallbackServiceLocal {
|
| @Resource(mappedName = "jbossws-client/service/AuthorizationCallbackService")
| protected AuthorizationCallbackService_PortType port;
|
| public void authorizationResponse(Long paymentId, Boolean status) {
| try {
| Stub stub = (Stub) port;
| stub._setProperty(Stub.USERNAME_PROPERTY, SecurityAssociation.getCallerPrincipal().getName());
| stub._setProperty(Stub.PASSWORD_PROPERTY, SecurityAssociation.getCredential());
|
| port.authorizationResponse(paymentId, status);
|
| } catch (Exception e) {
| throw new RuntimeException(e);
| }
| }
| }
|
Calling SecurityAssociation and setting the properties on the stub is the prioritary workaround that i would like to avoid.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983812#3983812
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983812
18 years, 1 month
[JBossWS] - Re: Problem with SAAJ Client for Webservice that receives at
by RomeuFigueira
Ok, further info.
This is from a very similar webservice, only difference in this one is that it deals with JPEGs.
These are TCPmon captures.
My Client (attachment output ommited):
POST /MediationAttachPic HTTP/1.1
| Accept: text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
| Content-Type: multipart/related;
| type="text/xml";
| boundary="----=_Part_1_17933220.1162911613951"
| Content-Length: 4228
| SOAPAction: ""
| Cache-Control: no-cache
| Pragma: no-cache
| User-Agent: Java/1.5.0_08
| Host: 127.0.0.1:8081
| Connection: keep-alive
|
| ------=_Part_1_17933220.1162911613951
| Content-Type: text/xml; charset=utf-8
|
| <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:com.mediation">
| <SOAP-ENV:Body>
| <urn:depositAttach>
| <id_lote>1</id_lote>
| <file_name>xml-pic</file_name>
| </urn:depositAttach>
| </SOAP-ENV:Body></SOAP-ENV:Envelope>
| ------=_Part_1_17933220.1162911613951
| Content-Type: image/jpeg
| Content-ID: <imgpart=5e62851c:10ec2ef030e:-8000@example.com>
SOAPui (attachment output ommited):
POST /MediationAttachPic HTTP/1.1
| SOAPAction: ""
| Content-Type: multipart/related;
| type="text/xml";
| start="<rootpart(a)soapui.org>";
| boundary="----=_Part_0_26490427.1162911728786"
| MIME-Version: 1.0
| User-Agent: Jakarta Commons-HttpClient/3.0.1
| Host: 127.0.0.1:8081
| Content-Length: 4381
|
|
| ------=_Part_0_26490427.1162911728786
| Content-Type: text/xml; charset=UTF-8
| Content-Transfer-Encoding: 8bit
| Content-ID: <rootpart(a)soapui.org>
| <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:com.mediation">
| <soapenv:Header/>
| <soapenv:Body>
| <urn:depositAttach>
| <id_lote>2</id_lote>
| <file_name>xml_pic</file_name>
| </urn:depositAttach>
| </soapenv:Body>
| </soapenv:Envelope>
| ------=_Part_0_26490427.1162911728786
| Content-Type: image/jpeg
| Content-Transfer-Encoding: binary
| Content-ID:
| <imgpart=15912942847484(a)soapui.org>
The main difference to me is this line, which I believe is the one causing errors:
start="<rootpart(a)soapui.org>";
How can I define this in my client?
SAAJ_ATTACH_CLIENT
| public class SAAJ_Attach_Client
| {
| public static final String NAMESPACE_URI = "com.mediation";
| public static final String PREFIX = "urn";
| public static final String METHOD = "depositAttach";
| public static final File attach = new File("xml-pic.jpg");
| public static final String WS_URI = "http://localhost:8081/MediationAttachPic";
|
| public static void main(String[] args)
| {
|
| try
| {
| MessageFactory msgFactory = MessageFactory.newInstance();
| SOAPMessage msg = msgFactory.createMessage();
| SOAPPart soapPart = msg.getSOAPPart();
| SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
|
| soapEnvelope.addNamespaceDeclaration(PREFIX,PREFIX+":"+NAMESPACE_URI);
|
| // for this tutorial web service, we don't have any headers,
| // so detach the one we get for "free":
| SOAPHeader soapHeader = soapEnvelope.getHeader();
| soapHeader.detachNode();
|
| // to the body, add the document we want to send to the
| // profile update web service:
| SOAPBody body = msg.getSOAPBody();
| SOAPFactory soapFactory = SOAPFactory.newInstance();
| Name bodyName = soapFactory.createName(METHOD,PREFIX, "");
| SOAPBodyElement bodyElement = body.addBodyElement(bodyName);
|
| // add the "profileID" element:
| Name profileIDParamName = soapFactory.createName("id_lote");
| SOAPElement profileID = bodyElement.addChildElement(profileIDParamName);
| profileID.addTextNode("1");
|
| // add the "profilePhotoRef" reference to the photo we will attach:
| Name profilePhotoRefParamName = soapFactory.createName("file_name");
| SOAPElement profilePhotoRef = bodyElement.addChildElement(profilePhotoRefParamName);
|
| profilePhotoRef.addTextNode("xml-pic");
|
| // get the image file and attach it:
| AttachmentPart binaryAttachPart = null;
|
| FileDataSource binaryFds = new FileDataSource(attach);
| DataHandler binaryFileHandler = new DataHandler(binaryFds);
| binaryAttachPart = msg.createAttachmentPart(binaryFileHandler);
| binaryAttachPart.setContentType("image/jpeg");
|
| binaryAttachPart.setContentId("<imgpart="+ (new java.rmi.server.UID()).toString() + "@example.com>");
| msg.addAttachmentPart(binaryAttachPart);
|
| if (msg.saveRequired())
| {
| msg.saveChanges();
| }
|
| // echo the document first:
| System.out.println("\nAbout to send the following SOAPMessage:\n");
| msg.writeTo(System.out);
| System.out.println("\nto endpoint URL " + WS_URI + "\n");
|
| // ...then send it, and echo the response:
| SOAPConnectionFactory soapConnFactory = SOAPConnectionFactory.newInstance();
| SOAPConnection soapConn = soapConnFactory.createConnection();
| SOAPMessage responseMsg = soapConn.call(msg, WS_URI);
| System.out.println("\nGot the following SOAPMessage in response:\n");
| responseMsg.writeTo(System.out);
|
| // in real life, declare outside of block and close in finally
| soapConn.close();
| }
| catch (IOException ioe)
| {
| System.err.println("IOException writing SOAPMessage: '" + ioe.getMessage() + "'");
| }
| catch (SOAPException se)
| {
| System.err.println("SOAPException: '" + se.getMessage() + "'");
| System.err.println(" Cause: '" + se.getCause().getClass().getName() + "': " + se.getCause().getMessage());
| }
|
| }
|
| public SAAJ_Attach_Client()
| {
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983789#3983789
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983789
18 years, 1 month
[JBossWS] - JAXBDeserializer unmarshalling
by alesj
I have this unmarshalling problem:
|
| @XmlRootElement(name = "createAccountReturn")
| public class Account implements Serializable {
|
| @XmlElement(name = "username") public String username;
| @XmlElement(name = "password") public String password;
| @XmlElement(name = "creationDate") public Date creationDate;
|
| public String toString() {
| return "Account{" +
| "username='" + username + '\'' +
| ", password='" + password + '\'' +
| ", creationDate=" + creationDate +
| '}';
| }
|
| }
|
| public static void main(String[] args) {
| Class javaType = Account.class;
| String xml = "<createAccountReturn xmlns='http://localhost:8080/jaxrpc/axis/AccountService'><password>password12</password><creationDate>2006-11-07T13:44:01.515Z</creationDate><username>creator</username></createAccountReturn>";
| try {
| JAXBContext jaxbContext = JAXBContext.newInstance(javaType);
| Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
| ByteArrayInputStream ins = new ByteArrayInputStream(xml.getBytes("UTF-8"));
| JAXBElement jbe = unmarshaller.unmarshal(new StreamSource(ins), javaType);
| Object value = jbe.getValue();
| System.out.println("value = " + value);
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
|
trying to unmarshall this xml:
| <createAccountReturn xmlns='http://localhost:8080/jaxrpc/axis/AccountService'>
| <password>password12</password>
| <creationDate>2006-11-07T13:44:01.515Z</creationDate>
| <username>creator</username>
| </createAccountReturn>
|
But I always get value = Account{username='null', password='null', creationDate=null}.
No idea what I'm doing wrong...
Rgds, Ales
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983764#3983764
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983764
18 years, 1 month