XFire

Namespace declarations too verbose

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.1.2
  • Fix Version/s: 1.2
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

Creating issue as requested by Dan on xfire user list, thread "how to enforce namespace/prefix usage in SOAP replies?":

Hi Jochen,
This seems to be a bug in how we're using stax. It should be an easy
enough tweak, but we'll have to patch the main code to do this. Could
you please file a JIRA issue? Thanks.
/ Dan

Jochen Hergeroeder wrote:

Hi,

I am using XFire 1.1.2 together with the org.codehaus.xfire.spring.XFireSpringServlet and JSR 181 annotations.

I am declaring an Interface to be exposed as a web service like this:

package de.company.project.server.core.services.internal.designTask;
@WebService(targetNamespace= http://webservices.project.company )
public interface DesignTaskService
{
...
}

@WebService(serviceName = "DesignTaskService",
endpointInterface = "de.company.project.server.core.services.designTask.DesignTaskService")
public class DesignTaskServiceImpl implements DesignTaskService
...

The Interface declares methods having bean parameters from (recursively) different packages:

  • de.company.project.server.core.services.internal.designTask
  • de.company.project.server.core.services

The generated WSDL file correctly declares a namespace for each involved package, together with a prefix, like:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ns1="http://designTask.services.core.server.project.company.de"
xmlns:tns=http://webservices.project.company
targetNamespace=http://webservices.project.company>
<wsdl:types xmlns:ns2="http://services.core.server.project.company.de">
...

But the SOAP reply does not use the namespace prefixes at all, instead
declaring the namespace for each bean property, like this:

<?xml version='1.0' encoding='UTF-8'?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<soap:Body><getDesignTaskDetailResponse
xmlns="http://webservices.project.company">
<out xmlns="http://webservices.project.company">
<articleDetails xmlns="http://designTask.services.core.server.project.company.de">
<DesignTaskArticleDetail>
<articleData>
<dateOfIssue xmlns="http://services.core.server.project.company.de" xsi:nil="true" />
<designTaskId xmlns="http://services.core.server.project.company.de" xsi:nil="true" />
<deskName xmlns="http://services.core.server.project.company.de" xsi:nil="true" />
....

###########################
This seems to be much too verbose.
###########################

How can I enforce to declare the namespace at the bean-level instead of each property, e.g.

<articleData xmlns="http://services.core.server.project.company.de">
<dateOfIssue xsi:nil="true" />
<designTaskId xsi:nil="true" />
...

or even shorter:

<ns2:articleData">
<dateOfIssue xsi:nil="true" />
<designTaskId xsi:nil="true" />

or

<articleData">
<ns2:dateOfIssue xsi:nil="true" />
<ns2:designTaskId xsi:nil="true" />

Thanks in advance,

Jochen

Activity

Hide
Dan Diephouse added a comment -

I think this was probably caused by us not calling setPrefix() for stax, which I fixed in the latest 1.2 release. Things should be good now.

Show
Dan Diephouse added a comment - I think this was probably caused by us not calling setPrefix() for stax, which I fixed in the latest 1.2 release. Things should be good now.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: