Dinesh Arora

Greenhorn
+ Follow
since Apr 18, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Dinesh Arora

Ravinderjit Singh wrote:Try this way.



It does not work. I still get the same error.
org.apache.axis2.AxisFault: Transport level information does not match with SOAP Message namespace URI
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:90)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:353)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:548)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528)
at com.acn.bellGasApi.Client.main(Client.java:43)

I posted the same question on Stackoverflow as well and some one from Apache Axis 2 team replied that the issue is with the Service and not the client. I am using HttpTransportProperties.Authenticator correctly, however the service is changing the soap messaeg type and content type which is causing the issue. I only have the wsdl adn have not control over the service code as it maintained by third party.
11 years ago
Hi,
I have a wsdl and I generated the client code using adb client(Axis 2). The wsdl says that this request will be sent over Https url. I able to successfully create a stub using wsdl to java. However I am not sure how to Basic authentication. The documentation which tells me the details also says that I user name and pwd should be encoded using Base64.

The authentication method used is HTTP Basic . The user name and password will need to be encoded in a base64 format – UTF8 character set.

Example: Username:Password = “VXNlcm5hbWU6UGFzc3dvcmQ=”



BTW I have tried this wsdl in SOAP UI and and I am getting correct response but some how my java code won't work

Now Here is the wsdl


I have tried this:

This gives me following error:



Then I tried this

This gives me the following error:



Next I tried this: which I think is incorrect as it WS Security and not basic auth but what the heck I exhausted all my options


This gives the following error:



I am not sure what to do next and have checked all the documentation on Apache Axis2 and googled all over the place but could get the code to work.

Any suggestions
11 years ago
Get Murach's Java or
Head First
12 years ago
Yes it is possible. I have just implemented a code my application where my customer leaves my application site and goes to paypal page. Customer logs in and clicks "I agree" and gets back to my application/site.

I am using Spring framework. The first call that I mentioned above is where Paypal send me a token which I can use to actually charge the customer account. When customers reviews the final order on my site and decides to submit, I use this token and give a call to Paypal to charge the account.

How I am doing this:


Customer chooses option: I want to pay via Paypal. The call comes to my servlet.
Step 1. Get the paypal token. You will need to call the PayPal Api to get the token. Check Paypal developer guide.

Step 2. "Forward" customer to Paypal site by appending the token(REMEBER NEVER SEND PAYMENT INFORMATION IN THE URL.)

I fill in Paypal business value object (customer name, email, price, currecny etc.). Then I am forwarding the customer to this URL
String forwardUrl = https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=" + paypalResponseVO.getPayPalResponseVO().getApiToken();

Step3: After customer clicks agree on Paypal URL. Paypal automatically redirects the customer to my site. How is that possible. When you requested token number in step one, you pass information such as CancelUrl, SuccessUrl. Paypal uses this url to forward customer back to your site.

So now in my forward URL I have provided logic that if everything was fine then take the customer to the next page.

Step 4. Customer reviews the order and asks to charge the Paypal account. Use the same token number and send a another request to Paypal API to charge the account.
13 years ago
Use the requestDispatcher method to get to the same page.

Page1 -->Send params to servelet ---> Servlet appends the word"great" before params and then use requestDisptacher or sendredirect to get back to page.

Second option: Just use Ajax call to send the request and get the response back.
13 years ago
I don't know how many times this question has been asked but no one seems to answer satisfactorily.
I am following the Grails in Action book.

I have tried everything but cannot get this working. Seems like every new user is struggling with this issue. Grails team should post a list of common issue and solutions.

I am creating a business domain class and an address domain. Every business has one address and I am trying to create a integration test and however it does not work.

I created Integration test but when I run it I get this exception. Here is the code

class Business {


static hasOne = [address:Address];

String name;
String description;
Business business;



static constraints = {
name(size:3..100,nullable:false);
address(nullable:true);
}

static mapping = { address lazy:false }
}


class Address {
Business business;

String addressLine1;
String addressLine2;
String city;
String state;
String zipCode;
String email;
String phone;
String homePage;


static constraints = {
// zipCode(size:1..5,nullable:false);

}
}



Integration Test:

void saveCascadeAddess() {
def address = new Address(addressLine1: 'Line1', addressLine2: 'line 2',city:'city1');
def business = new Business(name:'b_name1', description:'desc1');
business.addToAddress(address);
assertNotNull business.save();

def checkBusiness = Business.get(business.id);
assertEquals 'b_name1', checkBusiness.name;

def checkAddress = checkBusiness.address;
assertEquals 'Line1', checkAddress.addressLine1;
}

Result - The test fails.

I have tried running this code in grails console as well but I get the MethodMissingException.
13 years ago
Hi,

Try Crimson editor or editPlus. They are small and you do not to go back and forth between command prompt to compile and run your code and check the output.

Thanks,
Dinesh

SCJP 1.4
17 years ago
Hi,
Here's the thing to ALWAYS keep in mind.

1. If you have defined a public class say "public class xyz{}" and a default class "class abc{}", then you MUST save the file as xyz.java

2. If you do not have ANY public class, say "class abc{}" and "class xyz{}", then you can save the file with any name ex - qwerty.java or abc.java or xyz.java

Thanks,
Dinesh
17 years ago
Hi,
You have created and implemented correctly. The code would compile but when you run you won't get anything, since there is no main method. Whenever you try to run something JVM looks for public static void main(String[] args){}. Unless you implement that, you won't get anything.

Add this as well,

public class RunBicycle{
public static void main (String [] args){
Bicycle b = new Bicycle();
// Now givimg new values to its class variables
b.changeCadence(5);
b.changeGear(6);
b.speedUp(7);
b.applyBrakes(3);

// Now printing the values
b.printStates();
}
}

NOTE: Save the file as RunBicycle.java and compile it as RunBicycle.java and execute as java RunBicycle.


Thanks,
Dinesh
17 years ago
They are both a part of Collection framework(LIST). Each ahs it's own advantage and disadvantage-

If you want a quick retreival of objects, use ArrayList.
If you have to do plenty of additiona and deletion, you can use Linked list
ArrayList does not maintain any order while inserting.
LinkedList manitian insertion order and can also sort itslef optionally to most recently access value.

It's a designing factor you might need to consider to improve the performance of a application/project.

Thanks,
Dinesh

SCJP 1.4
17 years ago
Hi,
System.gc() is a request where you ask the JVM to garbage collect. JVM may or may not do that. There is now way you can force it.

Thanks,
Dinesh
17 years ago
Hi,
Here's the thing that you should burn in when it comes to TRY and CATCH.

1. No matter whether an exception is thrown or not, finally block will be executed!!!.

2. If an exception is thrown, return will not be executed, catch and then finally both will be executed.
17 years ago
Yes SCJP is still valid. You can also go for upgrade or better still, go for SCJP 1.5 as that is the latest.
Hi,
When a class is loaded, static blocks get executed first. static methods don't get executed.
Consider a case where you have static variable and staic blocks as well, what happens when a class is laoded-
static variables - gets initialised first.
Next Static blocks get executed, in the sequence they appear.

Ex -

class test{

static { // gets executed second
i = 10;
}
static int i=0; // gets executed first

static {....} // gets executed third


Burn this in your mind, if you are plannig for SCJP, 'coz they would sure trick you on this.

}
17 years ago
Thanks everyone. I want to go ahead and sdvanced certification. Could anyone t let me know, what are the pre-requisite for SCJA.

Thanks,
Dinesh
17 years ago