nishigandharajurkar / wsdl2objc

Automatically exported from code.google.com/p/wsdl2objc
MIT License
0 stars 0 forks source link

Generated code causes "Unable to handle request without a valid action parameter. Please supply a valid soap action." error when calling WS #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create WS on .Net 3.5
2. Use wsdl2objc to generate code for the WS
3. Call the WS from an iPhone project using SOAP 1.2

What is the expected output?
"Hello, world"

What do you see instead?
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><soap:Code><
soap:Value>soap:Sender</soap:Value></soap:Code><soap:Reason><soap:Text
xml:lang="en">System.Web.Services.Protocols.SoapException: Unable to handle
request without a valid action parameter. Please supply a valid soap action.
   at System.Web.Services.Protocols.Soap12ServerProtocolHelper.RouteRequest()
   at
System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage
message)
   at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
   at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type,
HttpContext context, HttpRequest request, HttpResponse response)
   at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response,
Boolean&amp; abortProcessing)</soap:Text></soap:Reason><soap:Detail
/></soap:Fault></soap:Body></soap:Envelope>

What version of the product are you using? On what operating system?
Snow Leopard 10.6.1
Xcode 3.2.1 64-bit (Component versions: Xcode IDE: 1613.0 - Xcode Core:
1614.0 - ToolSupport: 1591.0)
Latest iPhone SDK as of October 15th, 2009
wsdl2objc -r145 compiled from svn sources

Please provide any additional information below.
This was mentioned in the UsageInstructions comments, the server expects a
given request type and the generated code sends another:

Expected request:
POST /ws/Service1.asmx HTTP/1.1
Host: 172.16.200.114
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <HelloWorld xmlns="http://tempuri.org/" />
  </soap12:Body>
</soap12:Envelope>

Generated request:
{
Soapaction = "http://tempuri.org/HelloWorld";
"Content-Length" = 395;
"Content-Type" = "application/soap+xml; charset=utf-8";
Host = "172.16.200.114";
"User-Agent" = wsdl2objc;
}

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:Service1Svc="http://tempuri.org/" xsl:version="1.0">
  <soap:Body>
    <HelloWorld xsi:type="Service1Svc:HelloWorld"/>
  </soap:Body>
</soap:Envelope>

Original issue reported on code.google.com by nicolas....@gmail.com on 15 Oct 2009 at 8:37

GoogleCodeExporter commented 9 years ago
In order to fix this the WSDLParser should be changed to generate other XML for 
ComplexTypes. You can fix 
this by editting "ComplexType_M.template" in the WSDLParser project itself, 
search for something like the 
snipped below and comment some of the lines out. (Or download the attached file.

- (xmlNodePtr)xmlNodeForDoc:(xmlDocPtr)doc elementName:(NSString *)elName
{
    xmlNodePtr root = xmlDocGetRootElement(doc);

    // xmlNsPtr xsi = xmlSearchNs(doc, root, (const xmlChar*)"xsi");

    xmlNodePtr node = xmlNewDocNode(doc, NULL, [elName xmlString], NULL);
    // xmlSetNsProp(node, xsi, (const xmlChar*)"type", (const xmlChar*)"%«schema.prefix»:%«typeName»");
//%IFEQ isInTargetNamespace false
    xmlSetNsProp(node, nil, (const xmlChar*)"xmlns", (const xmlChar*)"%«schema.fullName»");
//%ENDIF

    [self addAttributesToNode:node];

%IF hasSequenceElements
    [self addElementsToNode:node];
%ENDIF

    return node;
}

Original comment by mkad...@gmail.com on 20 Oct 2009 at 2:46

Attachments:

GoogleCodeExporter commented 9 years ago
This solution solved 2 issues for me:
1)the problem posted above: Unable to handle request without a valid action 
parameter...
2)A result of error 500 when sending a date parameter. Removing the date 
parameter 
resulted in the first error

Original comment by jasonala...@gmail.com on 7 Nov 2009 at 10:18

GoogleCodeExporter commented 9 years ago

In addition to original fix, this also fixed a "Object reference not set to an 
instance of an object." error for me.

Original comment by ragnarhe...@gmail.com on 5 Dec 2009 at 12:50

GoogleCodeExporter commented 9 years ago
Very good patch, works much better with it.

Original comment by alexej.k...@gmail.com on 5 Dec 2009 at 9:38

GoogleCodeExporter commented 9 years ago
Note this worked except I had to put back the last parameter elementNSPrefix 
which
was removed in your patch. It caused warnings and then runtime errors.

You made it:
- (xmlNodePtr)xmlNodeForDoc:(xmlDocPtr)doc elementName:(NSString *)elName 

Had to change it BACK to:
- (xmlNodePtr)xmlNodeForDoc:(xmlDocPtr)doc elementName:(NSString *)elName
elementNSPrefix:(NSString *)elNSPrefix

After that I did successfully connect to the webservice and the SOAPAction 
error went
away

Original comment by trup...@gmail.com on 17 Mar 2010 at 1:44

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This part of the code was superseded by a later patch. Please check if error is 
still there in 0.7-pre1

Original comment by hasse...@gmail.com on 1 Jun 2010 at 2:20

GoogleCodeExporter commented 9 years ago
Here i solved this issue...
http://greatindiaclub.oliwy.net/?p=511

It is very simple.. Just i changed the proxy code generated by wsdl2objc
I hope it will used full for you...

Original comment by boobal...@gmail.com on 29 Sep 2011 at 7:56