function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ZenfairZenfair 

Creating a Web service with different target name space

When I create web service and generate WSDL from it, salesforce creates targetnamespace like  targetNamespace="http://soap.sforce.com/schemas/class/ATestWebservice".

When a java/dot net client implements this web service and sends a xml message, this target name pace is used in soap body.

How ever we have a special requirement, where a customer is insisting to have a different target name space rather than default.

For example targetNamespace ="  http://ws.customername.com/ATestWebService

The Soap XML  message comes with this different tartnamespace and salesforce should be able to parse the message using this name space.

We are trying to get thsi fucntionality but no success.

 

I have posted some samples for clarity.

 

My question, is there any way to create a web service with different target name space other than default.

 

Please note that this is very simple in Java or dot net. Any help is most welcome!!

 

 

 

 

 

Sample WSDL created by default

  

<?xml version="1.0" encoding="UTF-8" ?>
- <!--
 Web Services API : ATestWebservice

  -->
- <definitions targetNamespace="http://soap.sforce.com/schemas/class/ATestWebservice" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://soap.sforce.com/schemas/class/ATestWebservice">
- <types>
- <xsd:schema elementFormDefault="qualified" targetNamespace="http://soap.sforce.com/schemas/class/ATestWebservice">

 

Sample Message from Default Salesforce Targetnamespace

 <SOAP-ENV:Body>
      <getStateName xmlns="http://soap.sforce.com/schemas/class/ATestWebservice">
         <statenum xsi:type="xsd:int">41</statenum>
         </m:getStateName>
      </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

 

Sample WSDL with different target name space(This is what we need to achieve)

  

<?xml version="1.0" encoding="UTF-8" ?>
- <!--
 Web Services API : ATestWebservice

  -->
- <definitions targetNamespace="http://ws.customername.com/ATestWebservice" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"

xmlns:tns="http://ws.customername.com/ATestWebservice">
- <types>
- <xsd:schema elementFormDefault="qualified"

targetNamespace="http://ws.customername.com/ATestWebservice">

 

Sample Message from Different Targetnamespace (This is what we need to achieve)

<SOAP-ENV:Body>
      <getStateName xmlns="http://ws.customername.com/ATestWebservice">
         <statenum xsi:type="xsd:int">41</statenum>
         </m:getStateName>
      </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

 
 
 
 
 
SuperfellSuperfell

This is not possible without you building some kind of proxy to modify the requests before they get to salesforce. Can you expand on the use case for this ?

ZenfairZenfair

Simon -Thank you for quick response.  

 

A company called "BB" has 100 customers to whom they send outbound soap xml messages. Company BB has got all their customers to develop a web service with same target name space.

Company BB, every time creates a same soap xml message with same target name space irrespecive of customer  when they need to post a soap xml message to any of these 100 customers. They have a table to get a specific customer's end point dynamically and posts the message only to that end point.

The intended customer receives soap xml and parses the message using target name space.

 

This way,  they are able to post soap xml messages to any number of clients by just developing one java class that sends out bound messages.

All this is created in Java platform.

 

I can not give client name as it is confidential. I can explain you in details over the phone or through email:

My phone is 310 218 3046 . My email is ravee@zenfair-solutions.com

 

SuperfellSuperfell

There's a new feature currently in pilot called apex rest services, this would allow you to write a listener in apex that can manually parse and handle the soap message.

ZenfairZenfair

Thank you Simon. Is there any time frame for this? Two months or more than that?

 

Java and .net provide this functionality to have any name space we want. I was just wondering if there is any undocumented way in APEX to specifiy target namespace.