This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Web Services and the fly likes JAX-WS TOP DOWN APPROACH Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAX-WS TOP DOWN APPROACH" Watch "JAX-WS TOP DOWN APPROACH" New topic
Author

JAX-WS TOP DOWN APPROACH

sreenivas vemula
Ranch Hand

Joined: Jan 21, 2012
Posts: 44
Hi,
I want a working example on developing a webservices using JAX-WS Top Down Approach.Actually I have an application which provides two webservices. For one of the webservices it deals with SAAJ. The request and response xml both contain SOAP attachment. The problem is that there is some error showing in both WSDL and XSD.

</complexType>
<xsd:complexType name="SimpleSwaType">
<xsd:sequence>
<xsd:element name="Attachment" type="wsi:swaRef"></xsd:element>
</xsd:sequence>
</xsd:complexType>

and prefix wsi is defined as
xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"

and Here is my Java class for the above complex type.

public class SimpleSwaType {

@XmlElement(name = "Attachment", required = true, type = String.class)
@XmlAttachmentRef
protected DataHandler attachment;

/**
* Gets the value of the attachment property.
*
* @return possible object is {@link String }
*
*/
public DataHandler getAttachment() {
return attachment;
}

/**
* Sets the value of the attachment property.
*
* @param value
* allowed object is {@link String }
*
*/
public void setAttachment(DataHandler value) {
this.attachment = value;
}

}

The error throwing at highlighted line and The error throwing is "src-resolve : Cannot resolve the name 'wsi:swaRef' to a(n) 'type definition' component."

Please help.

Thanks in advance.

Regards,
sreeni.

Nico Nicoo
Greenhorn

Joined: Apr 13, 2012
Posts: 3
Hello,

I have the same problem, with jaxws-rt 2.2.3 / Java5, except that for me the message was only a warning and the build finished successfully.

>[WARNING] src-resolve: Cannot resolve the name 'swaRef:swaRef' to a(n) 'type definition' component.

With Java6, a little more message in the console :

[WARNING] schema_reference.4: Failed to read schema document 'http://ws-i.org/pr
ofiles/basic/1.1/swaref.xsd', because 1) could not find the document; 2) the doc
ument could not be read; 3) the root element of the document is not <xsd:schema>


So here is a workaround I found : in my XSD attached to my WSDL, I changed :
<xs:import namespace="http://ws-i.org/profiles/basic/1.1/xsd" schemaLocation="http://ws-i.org/profiles/basic/1.1/swaref.xsd"/>
with
<xs:import namespace="http://ws-i.org/profiles/basic/1.1/xsd" schemaLocation="swaref.xsd"/>

after having downloaded http://ws-i.org/profiles/basic/1.1/xsd/swaref.xsd and put it in the directory of my WSDL.


However, it is a poor workaround, as it requires to modify the WSDL/XSD (what we should'nt have to do). I tried to use a catalog file (configuration of the jaxws-maven-plugin) : works for some WSDL, but not for all of them...

So questions for you :
- Do you access internet from your maven build ? Does it require a proxy configuration ?
- Do you use a catalog file ?
- Does the previous workaround is valid for you too ?


Thank you,







Nico Nicoo
Greenhorn

Joined: Apr 13, 2012
Posts: 3
'
Nico Nicoo
Greenhorn

Joined: Apr 13, 2012
Posts: 3
'
 
jQuery in Action, 2nd edition
 
subject: JAX-WS TOP DOWN APPROACH