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
RohitMRohitM 

No namespace in webservice callout

Hi all,

 

I am trying to invoke an external webservice from SFDC. I've imported the WSDL and generated APEX classes out of it. We are using certificate based authentication and hence I've given the certificate name in the apex client code too. However, when I invoke the external service, I found that the request doesn't have ANY namespace associated with it. (I got to know this from the logs at the external service end. Is there any way to log the request being sent from SFDC ? )

 

Expected request:

<env:Envelope>
<env:Header/>
<env:Body>
<QuoteRequest xmlns="http://www.aaa.com/aaa/QuoteRequest.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" end-customer-name="TEA CONSULTANTS, INC." standard-deal-status="Not Submitted" xsi:schemaLocation="http://www.aaa.com/aaa/QuoteRequest.xsd http://www.aaa.com/aaa/QuoteRequest.xsd"> <StandardRequestDetail product-type="Product"/> <StandardRequestDetail product-type="Product"/> </QuoteRequest>
</env:Envelope>
</env:Body>

 Actual request from SFDC :

<env:Envelope>
<env:Header/>
<env:Body>
<m:QuoteRequest standard-deal-status="Not Submitted" end-customer-name="TEA CONSULTANTS, INC.">
<StandardRequestDetail product-type="Product" />
<StandardRequestDetail product-type="Product" />
</m:QuoteRequest>
</env:Body>
</env:Envelope>

 As we can see, the QuoteRequest is marked with namespace 'm' in the actual request from SFDC, but the namespace reference 'm' doesn't have any namespace attached to it.

I've read some of the previous posts regarding this error but failed to find a solution. I've found that someone asked the elementFormDefault value of the XSD be changed to "qualified" but that didn't work either.

 

WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
	xmlns:s0="http://www.aaa/aaa/QuoteResponse.xsd"
	xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
	xmlns:tm="http://microsoft/wsdl/mime/textMatching/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.aaa/aaa/QuoteRequest.xsd"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.aaa/aaa/QuoteRequest.xsd"
	xmlns="http://schemas.xmlsoap.org/wsdl/">
	<types>
		<xs:schema targetNamespace="http://www.aaa/aaa/QuoteResponse.xsd"
			version="2.0" xmlns="http://www.aaa/aaa/QuoteResponse.xsd"
			xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
			<xs:element name="QuoteResponse" type="QuoteResponseType" />

			<xs:complexType name="QuoteResponseType">
				<xs:sequence>
					<xs:element maxOccurs="1" minOccurs="1"
						name="PaymentOptionsTable" type="PaymentOptionsTableType" />
					<xs:element maxOccurs="1" name="Description">
						<xs:simpleType>
							<xs:restriction base="xs:string" />
						</xs:simpleType>
					</xs:element>
					<xs:element maxOccurs="1" name="ErrorMessage">
						<xs:simpleType>
							<xs:restriction base="xs:string">
								<xs:maxLength value="2000" />
							</xs:restriction>
						</xs:simpleType>
					</xs:element>
				</xs:sequence>			
			</xs:complexType>
		</xs:schema>
		<xs:schema targetNamespace="http://www.aaa/aaa/QuoteRequest.xsd"
			version="2.0" xmlns="http://www.aaa/aaa/QuoteRequest.xsd"
			xmlns:xs="http://www.w3.org/2001/XMLSchema">

			<xs:element name="QuoteRequest" type="QuoteRequestType" />

			<xs:complexType name="QuoteRequestType">
				<xs:sequence>
					<xs:element maxOccurs="unbounded" minOccurs="0"
						ref="StandardRequestDetail" />
				</xs:sequence>
				<xs:attribute name="end-customer-name" use="optional">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:maxLength value="50" />
						</xs:restriction>
					</xs:simpleType>
				</xs:attribute>
				<xs:attribute name="standard-deal-status" use="optional">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:maxLength value="50" />
						</xs:restriction>
					</xs:simpleType>
				</xs:attribute>
			</xs:complexType>

			<xs:element name="StandardRequestDetail" type="StandardRequestDetailType" />

			<xs:complexType name="StandardRequestDetailType">
				<xs:attribute name="product-type" use="optional">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:maxLength value="50" />
						</xs:restriction>
					</xs:simpleType>
				</xs:attribute>
			</xs:complexType>		

		</xs:schema>
	</types>
	<message name="APricingServiceHandlerIn">
		<part name="parameters" element="tns:QuoteRequest" />
	</message>
	<message name="APricingServiceHandlerOut">
		<part name="parameters" element="s0:QuoteResponse" />
	</message>
	<portType name="APricingService">
		<operation name="APricingServiceHandler">
			<input message="tns:APricingServiceHandlerIn" />
			<output message="tns:APricingServiceHandlerOut" />
		</operation>
	</portType>
	<binding name="APricingService" type="tns:APricingService">
		<soap:binding style="document"
			transport="http://schemas.xmlsoap.org/soap/http" />
		<operation name="APricingServiceHandler">
			<soap:operation soapAction="ccxRequest" style="document" />
			<input>
				<soap:body use="literal" parts="parameters" />
			</input>
			<output>
				<soap:body use="literal" parts="parameters" />
			</output>
		</operation>
	</binding>
	<service name="APricingService">
		<port name="APricingService" binding="tns:APricingService">
			<soap:address
				location="http://aaa/aaa/pricingService" />
		</port>
	</service>
</definitions>

 

Any help ?

 

 

 

Cheers,

Rohit M