• krishna59
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies

Hi All,

 

I am making a webservice call out with the below apex class.

 

//Generated by wsdl2apex

public class washout {
public class request_element {
public washout.notification notification;
private String[] notification_type_info = new String[]{'notification','urn:WashOut','notification','1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:WashOut','false','false'};
private String[] field_order_type_info = new String[]{'notification'};
}
public class notification_response_element {
public Boolean ack;
private String[] ack_type_info = new String[]{'ack','http://www.w3.org/2001/XMLSchema','boolean','1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:WashOut','false','false'};
private String[] field_order_type_info = new String[]{'ack'};
}
public class notification {
public washout.sObject_x sObject_x;
private String[] sObject_x_type_info = new String[]{'sObject','urn:WashOut','sObject','1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:WashOut','false','false'};
private String[] field_order_type_info = new String[]{'sObject_x'};
}
public class sObject_x {
public String id;
public Boolean isDeleted;
public String recordTypeId;
private String[] id_type_info = new String[]{'id','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] isDeleted_type_info = new String[]{'isDeleted','http://www.w3.org/2001/XMLSchema','boolean','1','1','false'};
private String[] recordTypeId_type_info = new String[]{'recordTypeId','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:WashOut','false','false'};
private String[] field_order_type_info = new String[]{'id','isDeleted','recordTypeId'};
}
public class salesforce_accounts_port {
public String endpoint_x = 'http://hq12.localtunnel.com/salesforce_accounts';
public Map<String,String> inputHttpHeaders_x;
public Map<String,String> outputHttpHeaders_x;
public String clientCertName_x;
public String clientCert_x;
public String clientCertPasswd_x;
public Integer timeout_x;
private String[] ns_map_type_info = new String[]{'urn:WashOut', 'washout'};
public Boolean notifications(washout.notification notification) {
washout.request_element request_x = new washout.request_element();
washout.notification_response_element response_x;
request_x.notification = notification;
Map<String, washout.notification_response_element> response_map_x = new Map<String, washout.notification_response_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'notifications',
'urn:WashOut',
'request',
'urn:WashOut',
'notification_response',
'washout.notification_response_element'}
);
response_x = response_map_x.get('response_x');
return response_x.ack;
}
}
}

 

But the response is not in the expected format and it is raising error

 

System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'urn:WashOut:notification_response' but found 'http://schemas.xmlsoap.org/soap/envelope/:notification_response' 

 

When i check logs in developer console the callout response is 

 

<?xml version="1.0" encoding="UTF-8"?>

<Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.xmlsoap.org/soap/envelope/">

<Body>

<notification_response>{"ack"=&gt;"true"}</notification_response>

</Body>

 </Envelope>

 

can any one help me on how to resolve this issue.

 

Thanks,

krishna59.

 

HI,

I am trying to generate apex code from wsdl.Below is the file content .The file parses fine.But while generating apex code i got the error Apex Generatoin Failed Element not defined for part 'notification_response'. 


Can any one help me on this.

 

<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:typens="urn:WashOut" targetNamespace="urn:WashOut" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xsd:schema targetNamespace="urn:WashOut">
<xsd:complexType name="request">
<xsd:sequence>
<xsd:element name="notification" type="typens:notification"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="notification">
<xsd:sequence>
<xsd:element name="sObject" type="typens:sObject"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="sObject">
<xsd:sequence>
<xsd:element name="id" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="notification_response">
<xsd:sequence>
<xsd:element name="ack" type="xsd:boolean"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="notifications">
<wsdl:part name="request" type="typens:request"></wsdl:part>
</wsdl:message>
<wsdl:message name="notifications_response">
<wsdl:part name="notification_response" type="typens:notification_response"></wsdl:part>
</wsdl:message>
<wsdl:portType name="salesforce_accounts_port">
<wsdl:operation name="notifications">
<wsdl:input message="typens:notifications"></wsdl:input>
<wsdl:output message="typens:notifications_response"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="salesforce_accounts_binding" type="typens:salesforce_accounts_port">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"></soap:binding>
<wsdl:operation name="notifications">
<soap:operation soapAction="notifications"></soap:operation>
<wsdl:input>
<soap:body use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:WashOut"></soap:body>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:WashOut"></soap:body>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="service">
<wsdl:port name="salesforce_accounts_port" binding="typens:salesforce_accounts_binding">
<soap:address location="http://localhost:3000/salesforce_accounts/action?controller=salesforce_accounts"></soap:address>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

 

 

 

 

Thanks,

Krishna.

 

Hi All,

 

I am making a webservice call out with the below apex class.

 

//Generated by wsdl2apex

public class washout {
public class request_element {
public washout.notification notification;
private String[] notification_type_info = new String[]{'notification','urn:WashOut','notification','1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:WashOut','false','false'};
private String[] field_order_type_info = new String[]{'notification'};
}
public class notification_response_element {
public Boolean ack;
private String[] ack_type_info = new String[]{'ack','http://www.w3.org/2001/XMLSchema','boolean','1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:WashOut','false','false'};
private String[] field_order_type_info = new String[]{'ack'};
}
public class notification {
public washout.sObject_x sObject_x;
private String[] sObject_x_type_info = new String[]{'sObject','urn:WashOut','sObject','1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:WashOut','false','false'};
private String[] field_order_type_info = new String[]{'sObject_x'};
}
public class sObject_x {
public String id;
public Boolean isDeleted;
public String recordTypeId;
private String[] id_type_info = new String[]{'id','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] isDeleted_type_info = new String[]{'isDeleted','http://www.w3.org/2001/XMLSchema','boolean','1','1','false'};
private String[] recordTypeId_type_info = new String[]{'recordTypeId','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:WashOut','false','false'};
private String[] field_order_type_info = new String[]{'id','isDeleted','recordTypeId'};
}
public class salesforce_accounts_port {
public String endpoint_x = 'http://hq12.localtunnel.com/salesforce_accounts';
public Map<String,String> inputHttpHeaders_x;
public Map<String,String> outputHttpHeaders_x;
public String clientCertName_x;
public String clientCert_x;
public String clientCertPasswd_x;
public Integer timeout_x;
private String[] ns_map_type_info = new String[]{'urn:WashOut', 'washout'};
public Boolean notifications(washout.notification notification) {
washout.request_element request_x = new washout.request_element();
washout.notification_response_element response_x;
request_x.notification = notification;
Map<String, washout.notification_response_element> response_map_x = new Map<String, washout.notification_response_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'notifications',
'urn:WashOut',
'request',
'urn:WashOut',
'notification_response',
'washout.notification_response_element'}
);
response_x = response_map_x.get('response_x');
return response_x.ack;
}
}
}

 

But the response is not in the expected format and it is raising error

 

System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'urn:WashOut:notification_response' but found 'http://schemas.xmlsoap.org/soap/envelope/:notification_response' 

 

When i check logs in developer console the callout response is 

 

<?xml version="1.0" encoding="UTF-8"?>

<Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.xmlsoap.org/soap/envelope/">

<Body>

<notification_response>{"ack"=&gt;"true"}</notification_response>

</Body>

 </Envelope>

 

can any one help me on how to resolve this issue.

 

Thanks,

krishna59.

 

HI,

I am trying to generate apex code from wsdl.Below is the file content .The file parses fine.But while generating apex code i got the error Apex Generatoin Failed Element not defined for part 'notification_response'. 


Can any one help me on this.

 

<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:typens="urn:WashOut" targetNamespace="urn:WashOut" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xsd:schema targetNamespace="urn:WashOut">
<xsd:complexType name="request">
<xsd:sequence>
<xsd:element name="notification" type="typens:notification"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="notification">
<xsd:sequence>
<xsd:element name="sObject" type="typens:sObject"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="sObject">
<xsd:sequence>
<xsd:element name="id" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="notification_response">
<xsd:sequence>
<xsd:element name="ack" type="xsd:boolean"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="notifications">
<wsdl:part name="request" type="typens:request"></wsdl:part>
</wsdl:message>
<wsdl:message name="notifications_response">
<wsdl:part name="notification_response" type="typens:notification_response"></wsdl:part>
</wsdl:message>
<wsdl:portType name="salesforce_accounts_port">
<wsdl:operation name="notifications">
<wsdl:input message="typens:notifications"></wsdl:input>
<wsdl:output message="typens:notifications_response"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="salesforce_accounts_binding" type="typens:salesforce_accounts_port">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"></soap:binding>
<wsdl:operation name="notifications">
<soap:operation soapAction="notifications"></soap:operation>
<wsdl:input>
<soap:body use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:WashOut"></soap:body>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:WashOut"></soap:body>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="service">
<wsdl:port name="salesforce_accounts_port" binding="typens:salesforce_accounts_binding">
<soap:address location="http://localhost:3000/salesforce_accounts/action?controller=salesforce_accounts"></soap:address>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

 

 

 

 

Thanks,

Krishna.