You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Anil K Patel (Jira)" <ji...@apache.org> on 2026/06/30 16:02:00 UTC

[jira] [Commented] (OFBIZ-743) Namespace declaration of services.xml has no affect on wsdl generation

    [ https://issues.apache.org/jira/browse/OFBIZ-743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18092692#comment-18092692 ] 

Anil K Patel commented on OFBIZ-743:
------------------------------------

Verified the fix on current {{trunk}}. The {{<namespace>}} element now correctly drives the WSDL {{targetNamespace}}; the default is unchanged when no namespace is declared.

h4. Test setup

Added a test service with a custom namespace to {{framework/common/servicedef/services.xml}}:

{code:xml}
<service name="testWsdlNamespace" engine="java"
        location="org.apache.ofbiz.common.CommonServices"
        invoke="ping" export="true">
    <description>Test service for WSDL namespace fix (OFBIZ-743)</description>
    <namespace>http://test.example.com/wsdl/</namespace>
    <attribute name="message" type="String" mode="IN" optional="true"/>
</service>
{code}

Restarted OFBiz and fetched the generated WSDL for the test service and for {{ping}} (which has no {{<namespace>}}).

Note: {{SOAPEventHandler}} reads the service name from the path info, so the working URL is {{/webtools/control/SOAPService/<serviceName>?wsdl}}. The {{SOAPService}} request-map and the {{soap}} event handler are both disabled by default (OFBIZ-12212), so they must be enabled to exercise this path.

h4. Results

*testWsdlNamespace* (custom namespace):
* {{targetNamespace="http://test.example.com/wsdl/"}}
* {{xmlns:tns="http://test.example.com/wsdl/"}}
* The custom namespace is applied consistently across {{<xsd:schema targetNamespace>}}, the request/response messages, the portType, the binding ({{type="tns:..."}}), both {{<soap:body namespace>}} elements, and the service element.

*ping* (no namespace declared):
* {{targetNamespace="http://ofbiz.apache.org/service/"}} (default, unchanged throughout)

h4. Minor observation (outside the scope of this fix)

One residual default-namespace reference remains in the test WSDL, inside the informational {{<wsdl:documentation>}} block, on a parameter's type reference:

{code:xml}
<attribute java-class="String" name="message" namespace="http://ofbiz.apache.org/service/" .../>
{code}

This comes from {{part.getTypeName().getNamespaceURI()}} (the parameter type QName via {{ModelParam.getWSDLPart()}}), not from the hardcoded {{TNS}} references that {{getTNS()}} replaced. It is documentation metadata only and does not affect the WSDL contract.


> Namespace declaration of services.xml has no affect on wsdl generation
> ----------------------------------------------------------------------
>
>                 Key: OFBIZ-743
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-743
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Trunk, Upcoming Branch
>         Environment: SUSE Linux 10.1 & MySQL 5.0.18
>            Reporter: Michael Imhof
>            Priority: Minor
>         Attachments: patch743.txt, patch743.txt
>
>
>     <service name="processImage" engine="simple" default-entity-name="Archivindex"
>         location="ch/nowhow/isgate/archiv/ArchivServices.xml" invoke="processImage" export="true">
>         <namespace>http://nowhow.ch/isgate/</namespace>
>         ..
>     </service>
> Namespace Tag is not used!!
> Solution:
> ======
> Class: ModelService.java
> Add a new method:
>     private String getTNS() {
>         if (this.nameSpace == null || this.nameSpace.length() == 0) {
>             this.nameSpace = TNS;
>         }
>         return this.nameSpace;
>     }
> Replace every TNS with getTNS.
> Regards
> Michael



--
This message was sent by Atlassian Jira
(v8.20.10#820010)