XFire

Namespace declarations too verbose -- Reopened

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • 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
Dmitriy Likhten added a comment -

I have been experiencing the same issue in xFire 1.2.6... Is there a workaround?

No matter what I do I cannot eliminate the "xmlns="http://<package name here>" " from every single data element, so if I want to send 1000 pojos as a result set, I wind up sending almost double the data due to xmlns... The only way to remove this issue at least slightly is to set the targetNamespace="x" for every element, at least the data will be less, but its still 10 extra characters sent over the packet for every single piece of data, all of which are useless, and all of which waste valuable resources.

Show
Dmitriy Likhten added a comment - I have been experiencing the same issue in xFire 1.2.6... Is there a workaround? No matter what I do I cannot eliminate the "xmlns="http://<package name here>" " from every single data element, so if I want to send 1000 pojos as a result set, I wind up sending almost double the data due to xmlns... The only way to remove this issue at least slightly is to set the targetNamespace="x" for every element, at least the data will be less, but its still 10 extra characters sent over the packet for every single piece of data, all of which are useless, and all of which waste valuable resources.
Hide
jack tang added a comment -

how is things going on?

Show
jack tang added a comment - how is things going on?

People

Vote (3)
Watch (3)

Dates

  • Created:
    Updated: