• Kanou
  • NEWBIE
  • 5 Points
  • Member since 2011

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

Hi,

 

I'm not quite sure if this falls under Apex or Java development but I decided to post it here.

 

I've created a number of Java classes and turned them into a web service using Axis2 1.4.1 and I seem to keep banging my head against the wall when trying to convert that into Apex code.

 

I go to Setup --> Develop --> Apex Classes and press the button "Generate from WSDL".

 

First I got an error message telling me that multiple bindings aren't allowed. So, I manually edit the WSDL removing the Soap11Binding and Soap12Binding, leaving only the HttpBinding.

 

Next, I get an error message that anyType isn't supported by SFDC. Scanning the Help & Training section I see that the "anyType" previously was mapped to "string". So, once again I manually edit my WSDL file and change anyType to string. Not sure if that's the right decision or not as my method returns a rather simple (Java) object with a couple of fields (a boolean and 3 Strings).

 

Now, it seems like all is well and I get to the 3rd and last step of the wizard but wrong again. On the 3rd, and final, step I'm presented with the following error:

 

Apex generation failed.


Error message:

Error: Unable to find soap 1.1 address

 

And that's where I'm at right now. Is there anyone out there who can point me in the right direction? All help and tips is appreciated.

 

I've worked a lot with axis1 but am new to axis2. My service/class is called PublicatorProTrialManager.java and when creating the client files for the WSDL I get PublicatorProTrialManager.java, PublicatorProTrialManagerLocator, PublicatorProTrialManagerPortType, PublicatorProTrialManagerPortTypeProxy, 2 binding stubs (soap 1.1 and soap 1.2) and a CreateTrialCustomerAndUserResponse.java (the method in the service is called createTrialCustomerAndUser and it returns an object called TrialResult.

 

Does that seem correct to you guys? I would have expected to also see Java files for my TrialResponse obect and the exceptions I've created as well. They would have been generated if I were to use axis1 so I'm a bit worried that I might be doing something wrong or missing some configuration.

 

Best regards,

 

Søren Nøskov Hansen

Zmags ApS

Message Edited by noedskov on 05-16-2009 05:48 PM
Message Edited by noedskov on 05-16-2009 05:58 PM
Message Edited by noedskov on 05-17-2009 02:45 AM
How do i resolve this...This is my code...I am sending an XML to an endpoint n number of times(its in a for loop)...Cant i do that?

public PageReference saveUsers() {
String[] listOfSelectedUsers = getUsers();
String domainId = System.currentPageReference().getParameters().get('ex');
for(String presentVar: listOfSelectedUsers)
{

Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('http://84.40.30.147/cm/spws');
req.setMethod('POST');

TestExtranet__c extranet = [select Extranet_Name__c from TestExtranet__c where id = :domainId];
Lead lead = [select id,firstname,lastname,email from Lead where id = :presentVar];
String requestXML = buildXMLRequest('createUser',extranet.Extranet_Name__c,lead.id,lead.firstname,lead.lastname,lead.email);

req.setBody(requestXML);
HttpResponse res = h.send(req);
XmlStreamReader reader = res.getXmlStreamReader();
boolean errorExists = parseResponseForError(reader);
if(!errorExists)
{
Extranet_User_Mapping__c mapping = new Extranet_User_Mapping__c();
mapping.Extranet_Id__c = domainId;
mapping.Leads__c = presentVar;
insert mapping;
}else
{

}


}
PageReference userConfPage = new PageReference('/apex/userConfirmation?ex='+ System.currentPageReference().getParameters().get('ex'));
return Page.userConfirmation;
}